427 lines
9.8 KiB
JSON
427 lines
9.8 KiB
JSON
{
|
|
"/api/v1/sqllab/": {
|
|
"get": {
|
|
"description": "Assembles SQLLab bootstrap data (active_tab, databases, queries, tab_state_ids) in a single endpoint. The data can be assembled from the current user's id.",
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/SQLLabBootstrapSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "Returns the initial bootstrap data for SqlLab"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Get the bootstrap data for SqlLab page",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/estimate/": {
|
|
"post": {
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/EstimateQueryCostSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "SQL query and params",
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"properties": {
|
|
"result": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"description": "Query estimation result"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Estimate the SQL query execution cost",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/execute/": {
|
|
"post": {
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ExecutePayloadSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "SQL query and params",
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/QueryExecutionResponseSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "Query execution result"
|
|
},
|
|
"202": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/QueryExecutionResponseSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "Query execution result, query still running"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"404": {
|
|
"$ref": "#/components/responses/404"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Execute a SQL query",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/export/{client_id}/": {
|
|
"get": {
|
|
"parameters": [
|
|
{
|
|
"description": "The SQL query result identifier",
|
|
"in": "path",
|
|
"name": "client_id",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"text/csv": {
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"description": "SQL query results"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"404": {
|
|
"$ref": "#/components/responses/404"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Export the SQL query results to a CSV",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/format_sql/": {
|
|
"post": {
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/FormatQueryPayloadSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "SQL query",
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"properties": {
|
|
"result": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"description": "Format SQL result"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Format SQL code",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/permalink": {
|
|
"post": {
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ExplorePermalinkStateSchema"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"properties": {
|
|
"key": {
|
|
"description": "The key to retrieve the permanent link data.",
|
|
"type": "string"
|
|
},
|
|
"url": {
|
|
"description": "permanent link.",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"description": "The permanent link was stored successfully."
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"422": {
|
|
"$ref": "#/components/responses/422"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Create a new permanent link",
|
|
"tags": [
|
|
"SQL Lab Permanent Link"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/permalink/{key}": {
|
|
"get": {
|
|
"parameters": [
|
|
{
|
|
"in": "path",
|
|
"name": "key",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"properties": {
|
|
"state": {
|
|
"description": "The stored state",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"description": "Returns the stored form_data."
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"404": {
|
|
"$ref": "#/components/responses/404"
|
|
},
|
|
"422": {
|
|
"$ref": "#/components/responses/422"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Get permanent link state for SQLLab editor.",
|
|
"tags": [
|
|
"SQL Lab Permanent Link"
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/sqllab/results/": {
|
|
"get": {
|
|
"parameters": [
|
|
{
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/sql_lab_get_results_schema"
|
|
}
|
|
}
|
|
},
|
|
"in": "query",
|
|
"name": "q"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/QueryExecutionResponseSchema"
|
|
}
|
|
}
|
|
},
|
|
"description": "SQL query execution result"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/400"
|
|
},
|
|
"401": {
|
|
"$ref": "#/components/responses/401"
|
|
},
|
|
"403": {
|
|
"$ref": "#/components/responses/403"
|
|
},
|
|
"404": {
|
|
"$ref": "#/components/responses/404"
|
|
},
|
|
"410": {
|
|
"$ref": "#/components/responses/410"
|
|
},
|
|
"500": {
|
|
"$ref": "#/components/responses/500"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"jwt": []
|
|
}
|
|
],
|
|
"summary": "Get the result of a SQL query execution",
|
|
"tags": [
|
|
"SQL Lab"
|
|
]
|
|
}
|
|
}
|
|
}\n |