OpenMetadata Queries API
A `Query` entity represents a SQL query associated with data assets it is run against.
A `Query` entity represents a SQL query associated with data assets it is run against.
openapi: 3.0.1
info:
title: OpenMetadata APIs Agent Executions Queries API
description: Common types and API definition for OpenMetadata
contact:
name: OpenMetadata
url: https://open-metadata.org
email: openmetadata-dev@googlegroups.com
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
version: '1.13'
servers:
- url: /api
description: Current Host
- url: http://localhost:8585/api
description: Endpoint URL
security:
- BearerAuth: []
tags:
- name: Queries
description: A `Query` entity represents a SQL query associated with data assets it is run against.
paths:
/v1/queries/{id}/followers:
put:
tags:
- Queries
summary: Add a follower
description: Add a user identified by `userId` as follower of this model
operationId: addFollower_10
parameters:
- name: id
in: path
description: Id of the Query
required: true
schema:
type: string
format: uuid
requestBody:
description: Id of the user to be added as follower
content:
application/json:
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEvent'
'404':
description: model for instance {id} is not found
/v1/queries/{id}/usage:
put:
tags:
- Queries
summary: Add query usage
description: Add query usage
operationId: addQueryUsage
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EntityReference'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
delete:
tags:
- Queries
summary: remove query used in
description: remove Query Used in
operationId: removeQueryUsedIn
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EntityReference'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
/v1/queries/{id}/usedBy:
put:
tags:
- Queries
summary: Populate Used By Field
description: Add query users
operationId: addQueryUsedBy
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
/v1/queries/{id}/users:
put:
tags:
- Queries
summary: Add query users
description: Add query users
operationId: addQueryUsers
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
/v1/queries/bulk:
put:
tags:
- Queries
summary: Bulk create or update queries
description: Create or update multiple queries in a single operation. Returns a BulkOperationResult with success/failure details for each query.
operationId: bulkCreateOrUpdateQueries
parameters:
- name: async
in: query
schema:
type: boolean
default: false
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CreateQuery'
responses:
'200':
description: Bulk operation results
content:
application/json:
schema:
$ref: '#/components/schemas/BulkOperationResult'
'202':
description: Bulk operation accepted for async processing
content:
application/json:
schema:
$ref: '#/components/schemas/BulkOperationResult'
'400':
description: Bad request
/v1/queries:
get:
tags:
- Queries
summary: Get a list of Queries
description: Get a list of queries. Use `fields` parameter to get only necessary fields. Use cursor-based pagination to limit the number entries in the list using `limit` and `before` or `after` query params. When filtering by `entityId`, also provide `entityType` to enable proper authorization based on the parent entity's permissions.
operationId: listQueries
parameters:
- name: fields
in: query
description: Fields requested in the returned resource
schema:
type: string
example: owners,followers,users,votes,tags,queryUsedIn
- name: entityId
in: query
description: UUID of the entity for which to list the Queries
schema:
type: string
format: uuid
- name: entityType
in: query
description: Type of the entity specified by entityId (e.g., 'table', 'storedProcedure'). Required when entityId is provided for proper authorization.
schema:
type: string
- name: service
in: query
description: Filter Queries by service Fully Qualified Name
schema:
type: string
- name: limit
in: query
description: Limit the number queries returned. (1 to 1000000, default = 10)
schema:
maximum: 1000000
minimum: 0
type: integer
format: int32
default: 10
- name: before
in: query
description: Returns list of queries before this cursor
schema:
type: string
- name: after
in: query
description: Returns list of queries after this cursor
schema:
type: string
responses:
'200':
description: Get List of queries
content:
application/json:
schema:
$ref: '#/components/schemas/QueryList'
put:
tags:
- Queries
summary: Create or update a query
description: Create a query, if it does not exist. If a query already exists, update the query.
operationId: createOrUpdateQuery
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateQuery'
responses:
'200':
description: The query
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
'400':
description: Bad request
post:
tags:
- Queries
summary: Create a query
description: Create a query under an existing entity.
operationId: createQuery
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateQuery'
responses:
'200':
description: The query
content:
application/json:
schema:
$ref: '#/components/schemas/QueryList'
'400':
description: Bad request
/v1/queries/name/{fqn}:
get:
tags:
- Queries
summary: Get a query by name
description: Get a query by fully qualified table name.
operationId: getQueryFqn
parameters:
- name: fqn
in: path
description: Fully qualified name of the query
required: true
schema:
type: string
- name: fields
in: query
description: Fields requested in the returned resource
schema:
type: string
example: owners,followers,users,votes,tags,queryUsedIn
responses:
'200':
description: query
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
'404':
description: Query for instance {id} is not found
delete:
tags:
- Queries
summary: Delete a query
description: Delete a query by `fullyQualifiedName`.
operationId: deleteQueryByFQN
parameters:
- name: fqn
in: path
description: Fully qualified name of the location
required: true
schema:
type: string
responses:
'200':
description: OK
'404':
description: Query for instance {fqn} is not found
patch:
tags:
- Queries
summary: Update a query using name.
description: Update an existing query using JsonPatch.
externalDocs:
description: JsonPatch RFC
url: https://tools.ietf.org/html/rfc6902
operationId: patchQuery
parameters:
- name: fqn
in: path
description: Name of the query
required: true
schema:
type: string
requestBody:
description: JsonPatch with array of operations
content:
application/json-patch+json:
schema:
$ref: '#/components/schemas/JsonPatch'
example: '[{op:remove, path:/a},{op:add, path: /b, value: val}]'
responses:
default:
description: default response
content:
application/json: {}
/v1/queries/{id}:
get:
tags:
- Queries
summary: Get a query
description: Get a Query by `id`
operationId: getQueryById
parameters:
- name: id
in: path
description: query Id
required: true
schema:
type: string
format: uuid
- name: fields
in: query
description: Fields requested in the returned resource
schema:
type: string
example: owners,followers,users,votes,tags,queryUsedIn
responses:
'200':
description: query
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
'404':
description: Query for instance {id} is not found
delete:
tags:
- Queries
summary: Delete a query
description: Delete a query by `id`.
operationId: deleteQuery
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
'404':
description: Query for instance {id} is not found
patch:
tags:
- Queries
summary: Update a query
description: Update an existing query using JsonPatch.
externalDocs:
description: JsonPatch RFC
url: https://tools.ietf.org/html/rfc6902
operationId: patchQuery_1
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
requestBody:
description: JsonPatch with array of operations
content:
application/json-patch+json:
schema:
$ref: '#/components/schemas/JsonPatch'
example: '[{op:remove, path:/a},{op:add, path: /b, value: val}]'
responses:
default:
description: default response
content:
application/json: {}
/v1/queries/async/{id}:
delete:
tags:
- Queries
summary: Asynchronously delete a query
description: Asynchronously delete a query by `id`.
operationId: deleteQueryAsync
parameters:
- name: id
in: path
description: Id of the query
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
'404':
description: Query for instance {id} is not found
/v1/queries/{id}/followers/{userId}:
delete:
tags:
- Queries
summary: Remove a follower
description: Remove the user identified `userId` as a follower of the model.
operationId: deleteFollower_13
parameters:
- name: id
in: path
description: Id of the Query
required: true
schema:
type: string
format: uuid
- name: userId
in: path
description: Id of the user being removed as follower
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEvent'
/v1/queries/{id}/versions/{version}:
get:
tags:
- Queries
summary: Get a specific version of the query
description: Get a version of the query by given `id`
operationId: getSpecificQueryVersion
parameters:
- name: id
in: path
description: Query Id
required: true
schema:
type: string
format: uuid
- name: version
in: path
description: Query version number in the form `major`.`minor`
required: true
schema:
type: string
example: 0.1 or 1.1
responses:
'200':
description: query
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
'404':
description: query for instance {id} and version {version} is not found
/v1/queries/history:
get:
tags:
- Queries
summary: List all entity versions within a time range
description: 'Get a paginated list of all entity versions within a given time range specified by `startTs` and `endTs` in milliseconds since epoch. '
operationId: listAllEntityVersionsByTimestamp_37
parameters:
- name: startTs
in: query
description: Start timestamp in milliseconds since epoch
required: true
schema:
type: integer
format: int64
- name: endTs
in: query
description: End timestamp in milliseconds since epoch
required: true
schema:
type: integer
format: int64
- name: limit
in: query
description: Limit the number of entity returned (1 to 1000000, default = 10)
schema:
maximum: 500
minimum: 1
type: integer
format: int32
default: 10
- name: before
in: query
description: Returns list of entity versions before this cursor
schema:
type: string
- name: after
in: query
description: Returns list of entity versions after this cursor
schema:
type: string
responses:
'200':
description: List of all versions
content:
application/json:
schema:
$ref: '#/components/schemas/ResultList'
/v1/queries/{id}/versions:
get:
tags:
- Queries
summary: Get List of all query versions
description: Get a list of all the versions of a query identified by `id`
operationId: listAllQueryVersion
parameters:
- name: id
in: path
description: Query Id
required: true
schema:
type: string
responses:
'200':
description: List of query versions
content:
application/json:
schema:
$ref: '#/components/schemas/EntityHistory'
/v1/queries/restore:
put:
tags:
- Queries
summary: Restore a soft deleted Query
description: Restore a soft deleted Query.
operationId: restore_28
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestoreEntity'
responses:
'200':
description: 'Successfully restored the Query '
content:
application/json:
schema:
$ref: '#/components/schemas/Query'
/v1/queries/{id}/vote:
put:
tags:
- Queries
summary: Update Vote for a Entity
description: Update vote for a Entity
operationId: updateVoteForEntity_13
parameters:
- name: id
in: path
description: Id of the Entity
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/VoteRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEvent'
'404':
description: model for instance {id} is not found
components:
schemas:
TagLabelRecognizerMetadata:
required:
- recognizerId
- recognizerName
- score
type: object
properties:
recognizerId:
type: string
format: uuid
recognizerName:
type: string
score:
type: number
format: double
target:
type: string
enum:
- content
- column_name
patterns:
type: array
items:
$ref: '#/components/schemas/PatternMatch'
Query:
required:
- id
- name
- query
- service
type: object
properties:
id:
type: string
format: uuid
name:
maxLength: 256
minLength: 1
pattern: ^((?!::).)*$
type: string
fullyQualifiedName:
maxLength: 3072
minLength: 1
type: string
displayName:
type: string
description:
type: string
version:
type: number
format: double
updatedAt:
type: integer
format: int64
updatedBy:
type: string
impersonatedBy:
type: string
href:
type: string
format: uri
changeDescription:
$ref: '#/components/schemas/ChangeDescription'
incrementalChangeDescription:
$ref: '#/components/schemas/ChangeDescription'
owners:
type: array
items:
$ref: '#/components/schemas/EntityReference'
duration:
type: number
format: double
users:
type: array
items:
$ref: '#/components/schemas/EntityReference'
followers:
type: array
items:
$ref: '#/components/schemas/EntityReference'
votes:
$ref: '#/components/schemas/Votes'
query:
type: string
query_type:
type: string
exclude_usage:
type: boolean
checksum:
type: string
queryDate:
type: integer
format: int64
usedBy:
uniqueItems: true
type: array
items:
type: string
tags:
type: array
items:
$ref: '#/components/schemas/TagLabel'
queryUsedIn:
type: array
items:
$ref: '#/components/schemas/EntityReference'
triggeredBy:
$ref: '#/components/schemas/EntityReference'
processedLineage:
type: boolean
service:
$ref: '#/components/schemas/EntityReference'
domains:
type: array
items:
$ref: '#/components/schemas/EntityReference'
entityStatus:
type: string
enum:
- Draft
- In Review
- Approved
- Archived
- Deprecated
- Rejected
- Unprocessed
provider:
type: string
enum:
- system
- user
- automation
extension:
type: object
children:
type: array
items:
$ref: '#/components/schemas/EntityReference'
style:
$ref: '#/components/schemas/Style'
experts:
type: array
items:
$ref: '#/components/schemas/EntityReference'
reviewers:
type: array
items:
$ref: '#/components/schemas/EntityReference'
dataProducts:
type: array
items:
$ref: '#/components/schemas/EntityReference'
deleted:
type: boolean
dataContract:
$ref: '#/components/schemas/EntityReference'
usageSummary:
$ref: '#/components/schemas/UsageDetails'
lifeCycle:
$ref: '#/components/schemas/LifeCycle'
certification:
$ref: '#/components/schemas/AssetCertification'
BulkOperationResult:
type: object
properties:
dryRun:
type: boolean
status:
type: string
enum:
- success
- failure
- aborted
- partialSuccess
- running
abortReason:
type: string
numberOfRowsProcessed:
minimum: 0
exclusiveMinimum: false
type: integer
format: int32
numberOfRowsPassed:
minimum: 0
exclusiveMinimum: false
type: integer
format: int32
numberOfRowsFailed:
minimum: 0
exclusiveMinimum: false
type: integer
format: int32
successRequest:
type: array
items:
$ref: '#/components/schemas/BulkResponse'
failedRequest:
type: array
items:
$ref: '#/components/schemas/BulkResponse'
CreateQuery:
required:
- query
- service
type: object
properties:
name:
maxLength: 256
minLength: 1
pattern: ^((?!::).)*$
type: string
displayName:
type: string
description:
type: string
owners:
type: array
items:
$ref: '#/components/schemas/EntityReference'
tags:
type: array
items:
$ref: '#/components/schemas/TagLabel'
query:
type: string
query_type:
type: string
exclude_usage:
type: boolean
duration:
type: number
format: double
users:
type: array
items:
type: string
usedBy:
uniqueItems: true
type: array
items:
type: string
dialect:
type: string
queryDate:
type: integer
format: int64
queryUsedIn:
type: array
items:
$ref: '#/components/schemas/EntityReference'
triggeredBy:
$ref: '#/components/schemas/EntityReference'
processedLineage:
type: boolean
service:
maxLength: 3072
minLength: 1
type: string
domains:
type: array
items:
type: string
extension:
type: object
reviewers:
type: array
items:
$ref: '#/components/schemas/EntityReference'
dataProducts:
type: array
items:
type: string
lifeCycle:
$ref: '#/components/schemas/LifeCycle'
ChangeSummaryMap:
type: object
AccessDetails:
required:
- timestamp
type: object
properties:
timestamp:
type: integer
format: int64
accessedBy:
$ref: '#/components/schemas/EntityReference'
accessedByAProcess:
type: string
FieldChange:
type: object
properties:
name:
type: string
oldValue:
type: object
newValue:
type: object
CoverImage:
type: object
properties:
url:
type: string
position:
type: string
RestoreEntity:
required:
- id
type: object
properties:
id:
type: string
format: uuid
LifeCycle:
type: object
properties:
created:
$ref: '#/components/schemas/AccessDetails'
updated:
$ref: '#/components/schemas/AccessDetails'
accessed:
$ref: '#/components/schemas/AccessDetails'
EntityHistory:
required:
- entityType
- versions
type: object
properties:
entityType:
type: string
versions:
type: array
items:
type: object
AssetCertification:
required:
- appliedDate
- expiryDate
- tagLabel
type: object
properties:
tagLabel:
$ref: '#/components/schemas/TagLabel'
appliedDate:
type: integer
format: int64
expiryDate:
type: integer
format: int64
VoteRequest:
type: object
properties:
updatedVoteType:
type: string
enum:
- votedUp
- votedDown
- unVoted
ResultList:
required:
- data
type: object
properties:
data:
type: array
items:
type: object
paging:
$ref: '#/components/schemas/Paging'
errors:
type: array
items:
$ref: '#/components/schemas/EntityError'
warningsCount:
type: integer
format: int32
warnings:
type: array
items:
$ref: '#/components/schemas/EntityError'
BulkResponse:
type: object
properties:
request:
type: object
message:
type: string
status:
type: integer
format: int32
Paging:
required:
- total
type: object
properties:
before:
type: string
after:
type: string
offset:
type: integer
format: int32
limit:
type: integer
format: int32
total:
type: integer
format: int32
JsonPatch:
type: object
ChangeDescription:
type: object
properties:
fieldsAdded:
type: array
items:
$ref: '#/components/schemas/FieldChange'
fieldsUpdated:
type: array
items:
$ref: '#/components/schemas/FieldChange'
fieldsDeleted:
type: array
items:
$ref: '#/components/schemas/FieldChange'
previousVersion:
type: number
format: double
changeSummary:
$ref: '#/components/schemas/ChangeSummaryMap'
ChangeEvent:
required:
- entityId
- entityType
- eventType
- id
- timestamp
type: object
properties:
id:
type: string
format: uuid
eventType:
type: string
enum:
- entityCreated
- entityUpdated
- entityFieldsChanged
- entityNoChange
- entitySoftDeleted
- entityDeleted
- entityRestored
- threadCreated
- threadUpdated
- postCreated
- postUpdated
- taskResolved
- taskClosed
- logicalTestCaseAdded
- suggestionCreated
- suggestionUpdated
- suggestionAccepted
- suggestionRejected
- suggestionDeleted
- userLogin
- userLogout
entityType:
type: string
entityId:
type: string
format: uuid
domains:
type: array
items:
type: string
format: uuid
entityFullyQualifiedName:
type: string
previousVersion:
type: number
format: double
currentVersion:
type: number
format: double
userName:
type: string
impersonatedBy:
type: string
timestamp:
type: integer
format: int64
changeDescription:
$ref: '#/components/schemas/ChangeDescription'
incrementalChangeDescription:
$ref: '#/components/schemas/ChangeDescription'
entity:
type: object
UsageStats:
required:
- count
type: object
properties:
count:
minimum: 0
exclusiveMinimum: false
type: integer
format: int32
percentileRank:
type: number
format: double
Style:
type: object
properties:
color:
type: string
iconURL:
type: string
coverImage:
$ref: '#/components/schemas/CoverImage'
Votes:
type: object
properties:
upVotes:
type: integer
format: int32
downVotes:
type: integer
format: int32
upVoters:
type: array
items:
$ref: '#/components/schemas/EntityReference'
downVoters:
type: array
items:
$ref: '#/components/schemas/EntityReference'
TagLabel:
required:
- labelType
- source
- state
- tagFQN
type: object
properties:
tagFQN:
type: string
name:
type: string
displayName:
type: string
description:
type: string
style:
$ref: '#/components/schemas/Style'
source:
type: string
enum:
- Classification
- Glossary
labelType:
type: string
enum:
- Manual
- Propagated
- Automated
- Derived
- Generated
state:
type: string
enum:
- Suggested
- Confirmed
href:
type: string
format: uri
reason:
type: string
appliedAt:
type: string
format: date-time
appliedBy:
type: string
metadata:
$ref: '#/components/schemas/TagLabelMetadata'
PatternMatch:
required:
- name
- score
type: object
properties:
name:
type: string
regex:
type: string
score:
type: number
format: double
TagLabelMetadata:
type: object
properties:
recognizer:
$ref: '#/components/schemas/TagLabelRecognizerMetadata'
expiryDate:
type: integer
format: int64
EntityError:
type: object
properties:
message:
type: string
entity:
type: object
EntityReference:
required:
- id
- type
type: object
properties:
id:
type: string
format: uuid
type:
type: string
name:
type: string
fullyQualifiedName:
type: string
description:
type: s
# --- truncated at 32 KB (33 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openmetadata/refs/heads/main/openapi/openmetadata-queries-api-openapi.yml