This provides the definition of a Streaming or Continuous Query, in addition to the metadata and metrics that show the state of the query within the system.
The four metrics that are shown are NumRecordsInPerSecond, NumRecordsOutPerSecond, NumBytesInPerSecond, and NumBytesOutPerSecond. The records in/out represent the current rate of messages being processed in and out at the time the DESCRIBE QUERY call was made. The Bytes in/out represent the current rate of data being processed and represented in binary Bytes at the time the call was made as well.
Note: Metrics may not always be available for queries, and when unavailable the stats will be replaced with n/a; see the example below with a query that has ERRORED.
See Query on how streaming queries operate in DeltaStream.
The Query will only be visible if the current role has USAGE privileges.
Arguments
query_uid
This is the unique identifier of the query to describe. See LIST QUERIES to find out how to list all queries that the user has access to. The first column (ID) in the response corresponds with the query_id.
Examples
Describe a simple query
The following describes a simple query with a Changelog source Relation, users_log, filtering on a userid column and writing the results into a Changelog sink Relation, users2468_log:
demodb.analytics/demostore#DESCRIBEQUERYb2041101-c37c-4807-93d4-2de876b7bd39; ID | State | DSQL | Owner | Created at | Updated at
---------------------------------------+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------------------+-----------------------
b2041101-c37c-4807-93d4-2de876b7bd39 | RUNNING | CREATE CHANGELOG users2468_log AS SELECT * FROM users_log WHERE userid = 'User_2' OR userid = 'User_4' OR userid = 'User_6' OR userid = 'User_8'; | sysadmin | 2023-01-12T20:46:00Z | 2023-01-12T20:46:00Z
Sources:Changelogusers_logSinks:Changelogusers2468_logQueryStats:NumRecordsInPerSecond|NumRecordsOutPerSecond|NumBytesInPerSecond|NumBytesOutPerSecond------------------------+------------------------+---------------------+-----------------------6|5|67B|49B
Describe a multi-source query
The following describes a JOIN query that joins a Stream, pageviews, and a Changelog Relation, users_log, on a userid column and writes the resulting records into a pv_user2468_interest Changelog Relation:
demodb.analytics/demostore#DESCRIBEQUERYc81fc632-a043-472d-a1fe-aa81bc9078df; ID | State | DSQL | Owner | Created at | Updated at
---------------------------------------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------------------+-----------------------
c81fc632-a043-472d-a1fe-aa81bc9078df | RUNNING | CREATE STREAM pv_user2468_interest WITH ('store'='kinesis_main') AS SELECT p.userid AS pvid, u.userid AS uid, u.gender, p.pageid, u.interests[1] AS top_interest FROM pageviews p JOIN users_log u ON u.userid = p.userid; | sysadmin | 2023-01-12T20:46:27Z | 2023-01-12T20:46:27Z
Sources:Changelogusers_logStreampageviewsSinks:Streampv_user2468_interestQueryStats:NumRecordsInPerSecond|NumRecordsOutPerSecond|NumBytesInPerSecond|NumBytesOutPerSecond------------------------+------------------------+---------------------+-----------------------20|25|160B|200B
Describe an ERRORED query
The following describes a query that was stopped due to an unrecoverable failure, leaving it in the ERRORED state:
demodb.analytics/demostore#DESCRIBEQUERYe2f995eb-1ece-4c19-8909-72cf75910091; ID | State | Dsql | Owner | Created At | Updated At
---------------------------------------+---------+-------------------------------------------------------------------------+----------+----------------------+-----------------------
e2f995eb-1ece-4c19-8909-72cf75910091 | ERRORED | CREATE STREAM userid AS SELECT userid as userid, pageid FROM pageviews; | sysadmin | 2022-05-25T15:37:01Z | 2022-05-25T15:37:01Z
Sources:StreampageviewsSinks:StreamuseridQueryStats:NumRecordsInPerSecond|NumRecordsOutPerSecond|NumBytesInPerSecond|NumBytesOutPerSecond------------------------+------------------------+---------------------+-----------------------n/a|n/a|n/a|n/aErrors:<errorstackisprintedhere>