cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.