On this page

    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

    Submit an SQL query and retrieve the associated job ID for use in Job API requests.

    Method and URL
    POST /api/v3/sql
    

    Parameters

    sql

    body

    String

    SQL query to run.

    Example SELECT * FROM "SF_Incidents2016.json" WHERE Category = 'NON-CRIMINAL' AND PdDistrict = 'BAYVIEW'


    context

    body

    [String]

    Optional

    Path to the container where the query should run within Dremio, expressed as an array. The path lists each level of heirarchy in order, from outer to inner: source or space first, then folder and subfolders.

    Example ["Samples", "samples.dremio.com"]


    Example Request
    curl -X POST 'https://{hostname}/api/v3/sql' \
    --header 'Authorization: _dremio{tokenstring}' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "sql": "SELECT * FROM \"SF_Incidents2016.json\" WHERE Category = '\''NON-CRIMINAL'\'' AND PdDistrict = '\''BAYVIEW'\''",
      "context": ["Samples", "samples.dremio.com"]
    }'
    
    Example Response
    {
      "id": "1c086675-7ed0-c70b-0222-64f53c5ed800"
    }
    

    Response Status Codes

    200

    OK

    400

    Bad Request

    401

    Unauthorized

    404

    Not Found