First, you need to create an access token from the Databricks workspace. This token will be used to authenticate your requests.
Open Postman and create a POST request. Set the URL to your Databricks cluster endpoint, specifically pointing to the API that allows for SQL query execution, usually something like https://<databricks-instance>/api/2.0/sql/execute
. Replace <databricks-instance>
with your actual instance URL.
In the Headers section, add a Content-Type
field with the value application/json
, and Authorization
with the value Bearer <your-access-token>
, replacing <your-access-token>
with the token generated earlier.
In the Body section, select the raw option and input the SQL query in JSON format. It might look something like this:
{
"clusterId": "<your-cluster-id>",
"language": "sql",
"query": "<your-sql-query>"
}
Replace <your-cluster-id>
with the ID of your cluster and <your-sql-query>
with the SQL query you want to run.
Click "Send" to execute the request. The result of the SQL query will be returned in the response.