Map Hyper-Q Log Events to Azure Synapse Log Events Using Backend Statement IDs (BSID)

 

Availability: Hyper-Q 3.39.0 and later.

 

When SQL statements from Teradata applications are translated by Hyper-Q for use with Azure Synapse Analytics, comments in the Teradata statements are removed, making it difficult to map events in Hyper-Q’s log files to those in Synapse. To enable you to more easily map such log events, Hyper-Q automatically applies a Synapse query label to queries.

A query label in Synapse SQL is an additional clause that you can apply to a query using the OPTION clause with the LABEL statement. This tag is helpful since the label is query-able and provides a mechanism for locating problem queries. To learn more about query labels in Synapse, see the Microsoft article Use query labels in Synapse SQL.

Hyper-Q lets you apply a backend statement ID (BSID) to queries as labels. The BSID is generated by taking the value of the Backend Request ID (BRID), and appends a four-digit number to the BRID value. The appended four-digit number increments with each statement in the resulting queries.

In the following example, DTM_BRID generates a comment with the BRID for the query. DTM_BSID then appends a four-digit number, which it in turn it applies as a label using the OPTION clause to the query statements.

 

select 1;select 2; 
-- DTM_BRID: e81de176-538d-4961-9745-f6dafce2e34f
-- DTM_QRY:
-- DTM_BSID: 'e81de176-538d-4961-9745-f6dafce2e34f.0001'
SELECT CAST ('1' AS smallint ) AS [1] OPTION (LABEL = 'e81de176-538d-4961-9745-f6dafce2e34f.0001' ) ;
-- DTM_BSID: 'e81de176-538d-4961-9745-f6dafce2e34f.0002'
SELECT CAST ('2' AS smallint ) AS [2] OPTION (LABEL = 'e81de176-538d-4961-9745-f6dafce2e34f.0002' ) 

Examples

Apply a Label to a Single Statement Request

Hyper-Q first generates a BRID and then adds appends a four-digit number to create a BSID. The BSID is added to the query using the OPTION clause with the LABEL statement.

select 1; 
-- DTM_BRID: e81de176-538d-4961-9745-f6dafce2e34f
-- DTM_QRY:
-- DTM_BSID: 'e81de176-538d-4961-9745-f6dafce2e34f.0001'
SELECT CAST ('1' AS smallint ) AS [1] OPTION (LABEL = 'e81de176-538d-4961-9745-f6dafce2e34f.0001' )

 

Apply a Label to a Multi-Statement Request

Hyper-Q first generates a BRID and then adds appends a four-digit number to create a BSID. A BSID is added to the query using the OPTION clause with the LABEL statement to each statement in the multi-statement request (MSR).

select 1;select 2; 
-- DTM_BRID: e81de176-538d-4961-9745-f6dafce2e34f
-- DTM_QRY:
-- DTM_BSID: 'e81de176-538d-4961-9745-f6dafce2e34f.0001'
SELECT CAST ('1' AS smallint ) AS [1] OPTION (LABEL = 'e81de176-538d-4961-9745-f6dafce2e34f.0001' ) ;
-- DTM_BSID: 'e81de176-538d-4961-9745-f6dafce2e34f.0002'
SELECT CAST ('2' AS smallint ) AS [2] OPTION (LABEL = 'e81de176-538d-4961-9745-f6dafce2e34f.0002' ) 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.