Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2024 05:52 PM - edited 12-29-2024 05:53 PM
Hello @Shivaprasad
Looks like the error is associated with the way you're trying to retrieve the data from the Unity Storage location.
As an alternative, let's try to use the 3 level namespace UC has to submit a query and retrieve the data.
e.g: instead of
SELECT * FROM delta.`<unity_storage_location>`
try:
SELECT * FROM <catalog_name>.<schema_name>.<table_name>
The rest api code snippet looks like below:
import requests
databricks_instance = "https://<databricks-instance>"
token = "<your_personal_access_token>"
warehouse_id = "<your_warehouse_id>"
query = "SELECT * FROM <catalog_name>.<schema_name>.<table_name> LIMIT 10"
url = f"{databricks_instance}/api/2.0/sql/statements"
data = {
"statement": query,
"warehouse_id": warehouse_id
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
statement_id = response.json()["statement_id"]
print("Query submitted. Statement ID:", statement_id)
else:
print("Error:", response.text)
Best,
Riz