File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed
Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 3535 ColumnTable ,
3636 ColumnQueue ,
3737 build_client_context ,
38+ get_session_config_value ,
3839)
3940from databricks .sql .parameters .native import (
4041 DbsqlParameterBase ,
@@ -386,6 +387,7 @@ def read(self) -> Optional[OAuthToken]:
386387 support_many_parameters = True , # Native parameters supported
387388 enable_complex_datatype_support = _use_arrow_native_complex_types ,
388389 allowed_volume_ingestion_paths = self .staging_allowed_local_path ,
390+ query_tags = get_session_config_value (session_configuration , 'query_tags' ),
389391 )
390392
391393 self ._telemetry_client .export_initial_telemetry_log (
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class DriverConnectionParameters(JsonSerializableMixin):
5757 support_many_parameters (bool): Whether many parameters are supported
5858 enable_complex_datatype_support (bool): Whether complex datatypes are supported
5959 allowed_volume_ingestion_paths (str): Allowed paths for volume ingestion
60+ query_tags (str): Query tags for tracking and attribution
6061 """
6162
6263 http_path : str
@@ -84,6 +85,7 @@ class DriverConnectionParameters(JsonSerializableMixin):
8485 support_many_parameters : Optional [bool ] = None
8586 enable_complex_datatype_support : Optional [bool ] = None
8687 allowed_volume_ingestion_paths : Optional [str ] = None
88+ query_tags : Optional [str ] = None
8789
8890
8991@dataclass
Original file line number Diff line number Diff line change 3838logger = logging .getLogger (__name__ )
3939
4040
41+ def get_session_config_value (
42+ session_configuration : Optional [Dict [str , Any ]],
43+ key : str
44+ ) -> Optional [str ]:
45+ """ Get a session configuration value with case-insensitive key matching """
46+ if not session_configuration :
47+ return None
48+
49+ key_upper = key .upper ()
50+ for k , v in session_configuration .items ():
51+ if k .upper () == key_upper :
52+ return str (v ) if v is not None else None
53+
54+ return None
55+
56+
4157class ResultSetQueue (ABC ):
4258 @abstractmethod
4359 def next_n_rows (self , num_rows : int ):
Original file line number Diff line number Diff line change @@ -520,6 +520,7 @@ def test_driver_connection_parameters_all_fields(self):
520520 support_many_parameters = True ,
521521 enable_complex_datatype_support = True ,
522522 allowed_volume_ingestion_paths = "/Volumes/catalog/schema/volume" ,
523+ query_tags = "team:engineering,project:telemetry" ,
523524 )
524525
525526 # Serialize to JSON and parse back
@@ -552,6 +553,7 @@ def test_driver_connection_parameters_all_fields(self):
552553 assert json_dict ["support_many_parameters" ] is True
553554 assert json_dict ["enable_complex_datatype_support" ] is True
554555 assert json_dict ["allowed_volume_ingestion_paths" ] == "/Volumes/catalog/schema/volume"
556+ assert json_dict ["query_tags" ] == "team:engineering,project:telemetry"
555557
556558 def test_driver_connection_parameters_minimal_fields (self ):
557559 """Test DriverConnectionParameters with only required fields."""
You can’t perform that action at this time.
0 commit comments