@@ -200,6 +200,12 @@ def read(self) -> Optional[OAuthToken]:
200200 STRUCT is returned as Dict[str, Any]
201201 ARRAY is returned as numpy.ndarray
202202 When False, complex types are returned as a strings. These are generally deserializable as JSON.
203+ :param enable_metric_view_metadata: `bool`, optional (default is False)
204+ When True, enables metric view metadata support by setting the
205+ spark.sql.thriftserver.metadata.metricview.enabled session configuration.
206+ This allows
207+ 1. cursor.tables() to return METRIC_VIEW table type
208+ 2. cursor.columns() to return "measure" column type
203209 """
204210
205211 # Internal arguments in **kwargs:
@@ -248,6 +254,14 @@ def read(self) -> Optional[OAuthToken]:
248254 access_token_kv = {"access_token" : access_token }
249255 kwargs = {** kwargs , ** access_token_kv }
250256
257+ enable_metric_view_metadata = kwargs .get ("enable_metric_view_metadata" , False )
258+ if enable_metric_view_metadata :
259+ if session_configuration is None :
260+ session_configuration = {}
261+ session_configuration [
262+ "spark.sql.thriftserver.metadata.metricview.enabled"
263+ ] = "true"
264+
251265 self .disable_pandas = kwargs .get ("_disable_pandas" , False )
252266 self .lz4_compression = kwargs .get ("enable_query_result_lz4_compression" , True )
253267 self .use_cloud_fetch = kwargs .get ("use_cloud_fetch" , True )
0 commit comments