Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Execute Sql Query

POST/api/v2/sqlQueries/execute
Warning

This endpoint is in preview and may be modified or removed at any time. To use this endpoint, add preview=true to the request query parameters.

Executes a new query. Only the user that invoked the query can operate on the query. The size of query results are limited by default to 1 million rows. Contact your Palantir representative to discuss limit increases.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:sql-queries-execute.

Query parameters

preview
boolean
optional

Enables the use of preview functionality.

Request body

ExecuteSqlQueryRequest
object
Hide child attributes

Hide child attributes

query
string

The SQL query to execute. Queries should confirm to the Spark SQL dialect. This supports SELECT queries only. Refer the following documentation on the supported syntax for referencing datasets in SQL queries.

fallbackBranchIds
list<BranchName>
optional

The list of branch ids to use as fallbacks if the query fails to execute on the primary branch. If a is not explicitly provided in the SQL query, the resource will be queried on the first fallback branch provided that exists. If no fallback branches are provided the default branch is used. This is master for most enrollments.

Show child attributes

Show child attributes

Response body

QueryStatus
union
Hide child attributes

Hide child attributes

running
object
optional
Show child attributes

Show child attributes

canceled
object
optional
failed
object
optional
Show child attributes

Show child attributes

succeeded
object
optional
Show child attributes

Show child attributes

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ -H "Content-type: application/json" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/sqlQueries/execute?preview=true" \ -d '{"fallbackBranchIds":["master"],"query":"SELECT * FROM `/Path/To/Dataset`"}'

Error responses

Error Name
ReadQueryInputsPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to access the inputs to the query.
Parametersrids
QueryParseErrorError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe query cannot be parsed.
ParameterserrorMessage
QueryCanceledError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe query was canceled.
ParametersqueryId
QueryPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to access the given query.
ParametersqueryId
QueryFailedError CodeINTERNAL
Status Code500
DescriptionThe query failed.
ParametersqueryId, errorMessage
QueryRunningError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe query is running.
ParametersqueryId
ExecuteSqlQueryPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not execute the SqlQuery.
Parameters