Apache Druid · JSON Structure

Apache Druid Sql Query Request Structure

Request body for the Apache Druid SQL query API (POST /druid/v2/sql).

Type: object Properties: 7 Required: 1
AnalyticsApacheDatabaseKafkaOLAPOpen SourceReal-TimeSQLTime Series

SqlQueryRequest is a JSON Structure definition published by Apache Druid, describing 7 properties, of which 1 is required. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

query resultFormat header typesHeader sqlTypesHeader context parameters

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/apache-druid/refs/heads/main/json-structure/apache-druid-sql-query-request-structure.json",
  "name": "SqlQueryRequest",
  "description": "Request body for the Apache Druid SQL query API (POST /druid/v2/sql).",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "SQL query string to execute.",
      "example": "SELECT __time, page, added FROM wikipedia WHERE __time > '2015-09-12' LIMIT 10"
    },
    "resultFormat": {
      "type": "string",
      "description": "Format for the query results.",
      "enum": [
        "object",
        "array",
        "objectLines",
        "arrayLines",
        "csv"
      ],
      "default": "object",
      "example": "object"
    },
    "header": {
      "type": "boolean",
      "description": "Whether to return column names in the first row (for array/objectLines formats).",
      "default": false,
      "example": false
    },
    "typesHeader": {
      "type": "boolean",
      "description": "Whether to include column data types in a header row.",
      "default": false,
      "example": false
    },
    "sqlTypesHeader": {
      "type": "boolean",
      "description": "Whether to include SQL type names in a header row.",
      "default": false,
      "example": false
    },
    "context": {
      "type": "object",
      "description": "Query context parameters for controlling execution behavior.",
      "properties": {
        "timeout": {
          "type": "int32",
          "description": "Query timeout in milliseconds.",
          "example": 30000
        },
        "priority": {
          "type": "int32",
          "description": "Query priority (lower is higher priority).",
          "example": 0
        },
        "queryId": {
          "type": "string",
          "description": "Custom query ID for tracking.",
          "example": "my-query-001"
        }
      }
    },
    "parameters": {
      "type": "array",
      "description": "Parameterized query values.",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "VARCHAR"
          },
          "value": {
            "type": "string",
            "example": "en"
          }
        }
      }
    }
  },
  "required": [
    "query"
  ]
}