update docs with X-Druid-SQL-Query-Id (#11761)

* update docs with X-Druid-SQL-Query-Id

* review comments

* update header description

* Update docs/querying/sql.md

Co-authored-by: Charles Smith <techdocsmith@gmail.com>

* Update docs/querying/sql.md

Co-authored-by: Charles Smith <techdocsmith@gmail.com>

Co-authored-by: Charles Smith <techdocsmith@gmail.com>
This commit is contained in:
Victoria Lim 2021-10-05 10:15:05 -07:00 committed by GitHub
parent ffbe303828
commit a31d99fb37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -871,13 +871,13 @@ Submit your query as the value of a "query" field in the JSON object within the
{"query" : "SELECT COUNT(*) FROM data_source WHERE foo = 'bar'"}
```
##### Request
##### Request body
|Property|Description|Default|
|--------|----|-----------|
|`query`|SQL query string.| none (required)|
|`resultFormat`|Format of query results. See [Responses](#responses) for details.|`"object"`|
|`header`|Whether or not to include a header. See [Responses] for details.|`false`|
|`header`|Whether or not to include a header row for the query result. See [Responses](#responses) for details.|`false`|
|`context`|JSON object containing [connection context parameters](#connection-context).|`{}` (empty)|
|`parameters`|List of query parameters for parameterized queries. Each parameter in the list should be a JSON object like `{"type": "VARCHAR", "value": "foo"}`. The type should be a SQL type; see [Data types](#data-types) for a list of supported SQL types.|`[]` (empty)|
@ -949,10 +949,14 @@ You can additionally request a header by setting "header" to true in your reques
}
```
In this case, the first result returned will be a header. For the `csv`, `array`, and `arrayLines` formats, the header
In this case, the first result of the response body is the header row. For the `csv`, `array`, and `arrayLines` formats, the header
will be a list of column names. For the `object` and `objectLines` formats, the header will be an object where the
keys are column names, and the values are null.
Druid returns the SQL query identifier in the `X-Druid-SQL-Query-Id` HTTP header.
This query id will be assigned the value of `sqlQueryId` from the [connection context parameters](#connection-context)
if specified, else Druid will generate a SQL query id for you.
Errors that occur before the response body is sent will be reported in JSON, with an HTTP 500 status code, in the
same format as [native Druid query errors](../querying/querying.md#query-errors). If an error occurs while the response body is
being sent, at that point it is too late to change the HTTP status code or report a JSON error, so the response will