cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

API Query

Yahya24
New Contributor III

Hello,

I created a sql warehouse (cluster size = 2X-Small) and I wanted to use it to execute a query using the sql query api:

- url : https://databricks-host/api/2.0/preview/sql/statements
- params = {
'warehouse_id': 'warehouse_id',
'statement': 'SELECT * FROM db1.table1;',
'wait_timeout': '0s'
}

I got a response with a status 200 but with text in xml.

On the other hand when I use the queries api https://databricks-host/api/2.0/preview/sql/queries it works well, I have a json with all my queries already defined.

Best regards,

1 ACCEPTED SOLUTION

Accepted Solutions

karthik_p
Esteemed Contributor

@Yahya24 can you please remove preview in query, they are not in preview any more "/api/2.0/sql/statements/", you should see json response, can you please check drop down menu and change to json, some times it may be setted into text, but usual response in json

karthik_p_0-1697646136922.png

 

View solution in original post

2 REPLIES 2

karthik_p
Esteemed Contributor

@Yahya24 can you please remove preview in query, they are not in preview any more "/api/2.0/sql/statements/", you should see json response, can you please check drop down menu and change to json, some times it may be setted into text, but usual response in json

karthik_p_0-1697646136922.png

 

Yahya24
New Contributor III

Hello @karthik_p,

My problem is solved, I removed "preview" but the real problem comes from the type of the API, I use it as GET while it is POST.

Thank you very much.