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
sql
String
The SQL query you want to run.
Note:
Double-quotation marks within a SQL statement need to be escaped.
context
[String]
Optional
The path for the SQL query to run in.
Example "context": ["Samples", "samples.dremio.com"]
Submitting a SQL Query
Submit a SQL query for Dremio Cloud to run, and retrieve the job ID.
Submitting a SQL QueryPOST /v0/projects/{project-id}/sql
Parameters
project-id
path
String (UUID)
Unique identifier of the project you want to submit a SQL query for.
sql
query
String
Create a SQL query to return the Job ID of the query.
Note:
Double-quotation marks within a SQL statement need to be escaped.
context
[String]
Optional
The path for the SQL query to run in.
Example ''context'': ["Samples", "samples.dremio.com"]
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\" }'
{
"id":"ab45c784-3593-5d12-0e42-0fgb5hij4k00"
}
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"]
}'
{
"id":"ab45c784-3593-5d12-0e42-0fgb5hij4k00"
}
Responses
400
Context is not correct or does not exist
401
Invalid token
404
Source does not exist
500
Query parsing error