SkastVnT commented on code in PR #66895:
URL: https://github.com/apache/airflow/pull/66895#discussion_r3264024008
##########
providers/databricks/src/airflow/providers/databricks/hooks/databricks_sql.py:
##########
@@ -71,6 +71,30 @@ def _cancel():
return timer, timeout_event
+def _format_query_tag_value(value: str) -> str:
+ """
+ Escape special characters and truncate a single query tag value.
+
+ Databricks ``QUERY_TAGS`` uses ``key:value`` pairs delimited by commas, so
+ backslash, comma and colon inside *values* must be escaped. Values are
also
+ capped at 128 characters before escaping to keep the overall tag string
+ within reasonable bounds.
+ """
+ value = str(value)[:128]
Review Comment:
Agreed. I added a warning when truncation happens and clarified in the code
comment that the raw source value is truncated before escaping.
The intent is to cap the original tag value at 128 characters before
serialization, rather than cap the final escaped QUERY_TAGS string.
--
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]