Shaan-alpha opened a new pull request, #66886:
URL: https://github.com/apache/airflow/pull/66886

   ### Description
   This PR addresses issue #66839 by injecting Airflow context metadata 
(dag_id,        ask_id, and  un_id) into the session_configuration parameter as 
query_tags during the execution of DatabricksSqlOperator and 
DatabricksCopyIntoOperator. 
   
   By automatically populating query tags, it significantly enhances 
observability on the Databricks side, allowing administrators and developers to 
trace specific queries executed in Databricks SQL directly back to the Airflow 
task run that spawned them.
   
   **Key Changes:**
   - Added a _format_query_tags(context) helper to extract and safely escape 
the metadata strings before formatting them into a comma-separated query tag 
string.
   - Modified the execute() methods of DatabricksSqlOperator and 
DatabricksCopyIntoOperator to correctly merge the generated tags into the 
existing session_configuration (preserving any user-defined custom query tags).
   - Updated existing unit tests and added      est_query_tags_injection for 
both operators in  est_databricks_sql.py and       est_databricks_copy.py to 
ensure injection and non-regression of user tags.
   
   ### Related Issues
   - Closes #66839
   
   ### Testing
   - Added unit tests mimicking operator execution and asserting proper 
manipulation of the hook's session_config parameter.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to