SQL
Use the SQL API to submit SQL queries. The response contains the ID for the job associated with the SQL query. Use the job ID in Job API requests to get more information about the job, including results.
Submit an SQL Query
Method and URLPOST /v0/projects/{project_id}/sql
Parameters
project_id Path String (UUID)
sql Body String
SQL query to run. Double quotation marks within a SQL statement must be escaped.
Example: SELECT * FROM Samples."samples.dremio.com"."SF weather 2018-2019.csv"
context Body Array of String Optional
Path to the container where the query should run within Dremio, expressed as an array. The path consists of the source, followed by the folder and subfolders.
Example:
[
"Samples",
"samples.dremio.com"
]
Examples
Request Using Only the SQL Parametercurl -X POST "https://api.dremio.cloud/v0/projects/$PROJECT_ID/sql" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json' \
--data-raw '{
"sql": "SELECT * FROM Samples.\"samples.dremio.com\".\"SF weather 2018-2019.csv\""
}'
curl -X POST "https://api.dremio.cloud/v0/projects/$PROJECT_ID/sql" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json' \
--data-raw '{
"sql": "SELECT * FROM \"SF weather 2018-2019.csv\"",
"context": [
"Samples",
"samples.dremio.com"
]
}'
{
"id": "ab45c784-3593-5d12-0e42-0fgb5hij4k00"
}
Response Status Codes
200 OK
400 Bad Request
401 Unauthorized
404 Not Found
500 Internal Server Error