:wave: Hello, team! I have a question . I am using...
# general
b
đź‘‹ Hello, team! I have a question . I am using pulumi-databricks to create a sql query in databricks using query api by providing query string ,warehouse id to which query to be executed etc. Query is getting created and saved under databricks queries but not executing . Do I need to use job api to trigger this sql as a job or is there any way to execute the query directly from query api after its saved ?
m
When you create a SQL query using the queries API, it saves the query definition—it does not execute it. This behavior is by design. To execute the query, you have two main options: 1) Use the databricks.Job resource to run saved queries 2) Use the Statement Execution API directly (Endpoint: POST /api/2.0/sql/statements) This API allows you to run an ad-hoc SQL statement against a specified SQL warehouse, eg. if you just want to execute SQL without saving or managing it as a job. You could call the API directly from your program if you want to run it on every pulumi command. Alternatively, you can use the Command provider to create a resource that runs the query via a script when it is created or updated.