Query History API Query History API
この記事の内容
重要
この機能はパブリック プレビュー 段階にあります。 This feature is in Public Preview . アクセスを要求するには、Azure Databricks の担当者にお問い合わせください。 Contact your Azure Databricks representative to request access.
重要
Databricks REST API にアクセスするには、認証 する必要があります。 To access Databricks REST APIs, you must authenticate .
List List
エンドポイント Endpoint
HTTP メソッド HTTP Method
2.0/sql/history/queries
GET
SQL エンドポイント を使用してクエリの履歴を一覧表示します。List the history of queries through SQL endpoints . ユーザー ID、エンドポイント ID、状態、時間範囲でフィルター処理できます。 You can filter by user ID, endpoint ID, status, and time range.
Request Request
フィールド名 Field Name
Type Type
[説明] Description
filter_by filter_by
QueryFilter QueryFilter
クエリ履歴の結果を制限するフィルター。 A filter to limit query history results. このフィールドは省略可能です。 This field is optional.
max_results max_results
INT32
1ページで返される結果の数を制限します。 Limit the number of results returned in one page. 既定値は、100 です。 The default is 100.
page_token page_token
STRING
結果の次のページを取得するために使用される非透過トークン。 Opaque token used to get the next page of results. このフィールドは省略可能です。 This field is optional.
Response Response
フィールド名 Field Name
Type Type
[説明] Description
next_page_token next_page_token
STRING
次のページを取得するために使用される非透過トークン。 Opaque token used to get the next page.
has_next_page has_next_page
BOOLEAN
結果の別のページがあるかどうか。 Whether there is another page of results.
res res
Queryinfo の配列Array of QueryInfo
クエリ結果。 Query results.
要求の例 Example request
{
"filter_by": {
"statuses": ["RUNNING"],
"user_ids": [12345],
"endpoint_ids": ["1234567890abcdef"],
},
"max_results": 100
}
応答の例 Example response
{
"next_page_token": "Ci0KJDU4NjEwZjY5LTgzNzUtNDdiMS04YTg1LWYxNTU5ODI5MDYyMhDdobu YuS4SABhk",
"has_next_page": true,
"res": [
{
"query_id": "26b5c452-1dff-429e-9b55-7c16131c89ee",
"status": "FINISHED",
"query_text": "select 1 + 1",
"query_start_time_ms": 1595357086200,
"execution_end_time_ms": 1595357086373,
"query_end_time_ms": 1595357087200,
"user_id": [12345],
"user_name": "user@example.com",
"spark_ui_url":"https://<databricks-instance>/sparkui/0710-201419-test887/driver-8401376710892156045/SQL/execution/?id=0",
"endpoint_id": "1234567890abcdef",
"rows_produced": 100,
},
{
"query_id": "26b5c452-1dff-429e-9b55-7c16131c89ee",
"status": "FAILED",
"query_text": "select 1 + 1",
"query_start_time_ms": 1595357196200,
"user_id": [12345],
"user_name": "user@example.com",
"endpoint_id": "1234567890abcdef",
"error_message": "Query failed because ...",
}
]
}
データ構造 Data structures
QueryFilter QueryFilter
フィールド名 Field Name
Type Type
[説明] Description
statuses statuses
QueryStatus の配列Array of QueryStatus
クエリの状態。 Statuses of queries.
user_ids user_ids
INT64
の配列Array of INT64
クエリを実行したユーザーの Id。 IDs of the users that ran the queries.
endpoint_ids endpoint_ids
STRING
の配列Array of STRING
クエリが実行されたエンドポイントの Id。 IDs of endpoints on which the queries ran.
query_start_time_range query_start_time_range
TimeRange TimeRange
クエリが開始された時刻の範囲。 Time range of when the queries started.
QueryInfo QueryInfo
フィールド名 Field Name
Type Type
[説明] Description
query_id query_id
INT64
クエリ ID。 Query ID.
status status
QueryStatus QueryStatus
クエリの状態。 Query status.
query_text query_text
STRING
クエリのテキスト。 The text of the query.
query_start_time_ms query_start_time_ms
INT64
クエリが開始された時刻。 The time the query started.
execution_end_time_ms execution_end_time_ms
INT64
クエリの実行が終了した時刻。 The time execution of the query ended.
query_end_time_ms query_end_time_ms
INT64
クエリが終了した時刻。 The time the query ended.
user_id user_id
INT64
クエリを実行したユーザーの ID。 ID of the user that ran the query.
user_name user_name
STRING
クエリを実行したユーザーの電子メールアドレス。 Email address of the user that ran the query.
spark_ui_url spark_ui_url
STRING
クエリプランの URL。 URL to the query plan.
endpoint_id endpoint_id
STRING
エンドポイント ID。 Endpoint ID.
error_message error_message
STRING
クエリが完了できなかった理由を説明するメッセージ。 Message describing why the query could not complete.
rows_produced rows_produced
INT32
クエリによって返された結果の数。 The number of results returned by the query.
QueryStatus QueryStatus
Status Status
説明 Description
QUEUED
クエリが受信され、キューに入れられました。 Query has been received and queued.
RUNNING
クエリの実行が開始されました。 Query execution has started.
CANCELED
クエリはユーザーによって取り消されました。 Query has been cancelled by the user.
FAILED
クエリの実行に失敗しました。 Query execution has failed.
FINISHED
クエリの実行が完了しました。 Query execution has completed.
TimeRange TimeRange
フィールド名 Field Name
Type Type
[説明] Description
start_time_ms start_time_ms
INT64
この時間が経過してから開始されたクエリに結果を制限します。 Limit results to queries that started after this time.
end_time_ms end_time_ms
INT64
この時間より前に開始されたクエリに結果を制限します。 Limit results to queries that started before this time.