Skip to main content

SQL

Use the SQL API to submit SQL queries. Requests to the SQL API return the job ID for the SQL query. Use the returned job ID to get job information and results with the Job API.

SQL Object
  {
"sql": "SELECT * FROM \"SF weather 2018-2019.csv\"",
"context": ["Samples", "samples.dremio.com"]
}

SQL Object Attributes

{{< api-section file="data/api/sql.json" data="SQLObject-attributes" >}}

Submitting a SQL Query

Submit a SQL query for Dremio Cloud to run, and retrieve the job ID.

Submitting a SQL Query
POST /v0/projects/{project-id}/sql

Parameters

{{< api-section file="data/api/sql.json" data="submittingASQLQuery" >}}

Example Request Using Only the SQL Attribute
curl -X POST 'https://api.dremio.cloud/v0/projects/02a36975-73bc-47de-9fg5-ff73060380f6/sql' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json' \
-d '{ "sql": "SELECT * FROM Samples.\"samples.dremio.com\".\"SF weather 2018-2019.csv\" }'
Example Response
{
"id":"ab45c784-3593-5d12-0e42-0fgb5hij4k00"
}
Example Request Using the Optional Context Attribute
curl -X POST 'https://api.dremio.cloud/v0/projects/02a36975-73bc-47de-9fg5-ff73060380f6/sql' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json' \
-d '{
"sql": "SELECT * FROM \"SF weather 2018-2019.csv\"",
"context": ["Samples", "samples.dremio.com"]
}'
Example Response
{
"id":"ab45c784-3593-5d12-0e42-0fgb5hij4k00"
}

Responses

{{< api-responses file="data/api/sql.json" data="submittingASQLQueryResponses" >}}