@@ -708,7 +708,7 @@ def _handle_staging_operation(
708708 session_id_hex = self .connection .get_session_id_hex (),
709709 )
710710
711- @log_latency ()
711+ @log_latency (StatementType . SQL )
712712 def _handle_staging_put (
713713 self , presigned_url : str , local_file : str , headers : Optional [dict ] = None
714714 ):
@@ -717,7 +717,6 @@ def _handle_staging_put(
717717 Raise an exception if request fails. Returns no data.
718718 """
719719
720- self .statement_type = StatementType .SQL
721720 if local_file is None :
722721 raise ProgrammingError (
723722 "Cannot perform PUT without specifying a local_file" ,
@@ -749,7 +748,7 @@ def _handle_staging_put(
749748 + "but not yet applied on the server. It's possible this command may fail later."
750749 )
751750
752- @log_latency ()
751+ @log_latency (StatementType . SQL )
753752 def _handle_staging_get (
754753 self , local_file : str , presigned_url : str , headers : Optional [dict ] = None
755754 ):
@@ -758,7 +757,6 @@ def _handle_staging_get(
758757 Raise an exception if request fails. Returns no data.
759758 """
760759
761- self .statement_type = StatementType .SQL
762760 if local_file is None :
763761 raise ProgrammingError (
764762 "Cannot perform GET without specifying a local_file" ,
@@ -778,13 +776,12 @@ def _handle_staging_get(
778776 with open (local_file , "wb" ) as fp :
779777 fp .write (r .content )
780778
781- @log_latency ()
779+ @log_latency (StatementType . SQL )
782780 def _handle_staging_remove (
783781 self , presigned_url : str , headers : Optional [dict ] = None
784782 ):
785783 """Make an HTTP DELETE request to the presigned_url"""
786784
787- self .statement_type = StatementType .SQL
788785 r = requests .delete (url = presigned_url , headers = headers )
789786
790787 if not r .ok :
@@ -793,7 +790,7 @@ def _handle_staging_remove(
793790 session_id_hex = self .connection .get_session_id_hex (),
794791 )
795792
796- @log_latency ()
793+ @log_latency (StatementType . QUERY )
797794 def execute (
798795 self ,
799796 operation : str ,
@@ -832,7 +829,6 @@ def execute(
832829 :returns self
833830 """
834831
835- self .statement_type = StatementType .QUERY
836832 logger .debug (
837833 "Cursor.execute(operation=%s, parameters=%s)" , operation , parameters
838834 )
@@ -879,7 +875,7 @@ def execute(
879875
880876 return self
881877
882- @log_latency ()
878+ @log_latency (StatementType . QUERY )
883879 def execute_async (
884880 self ,
885881 operation : str ,
@@ -895,7 +891,6 @@ def execute_async(
895891 :return:
896892 """
897893
898- self .statement_type = StatementType .QUERY
899894 param_approach = self ._determine_parameter_approach (parameters )
900895 if param_approach == ParameterApproach .NONE :
901896 prepared_params = NO_NATIVE_PARAMS
@@ -999,14 +994,13 @@ def executemany(self, operation, seq_of_parameters):
999994 self .execute (operation , parameters )
1000995 return self
1001996
1002- @log_latency ()
997+ @log_latency (StatementType . METADATA )
1003998 def catalogs (self ) -> "Cursor" :
1004999 """
10051000 Get all available catalogs.
10061001
10071002 :returns self
10081003 """
1009- self .statement_type = StatementType .METADATA
10101004 self ._check_not_closed ()
10111005 self ._close_and_clear_active_result_set ()
10121006 self .active_result_set = self .backend .get_catalogs (
@@ -1017,7 +1011,7 @@ def catalogs(self) -> "Cursor":
10171011 )
10181012 return self
10191013
1020- @log_latency ()
1014+ @log_latency (StatementType . METADATA )
10211015 def schemas (
10221016 self , catalog_name : Optional [str ] = None , schema_name : Optional [str ] = None
10231017 ) -> "Cursor" :
@@ -1027,7 +1021,6 @@ def schemas(
10271021 Names can contain % wildcards.
10281022 :returns self
10291023 """
1030- self .statement_type = StatementType .METADATA
10311024 self ._check_not_closed ()
10321025 self ._close_and_clear_active_result_set ()
10331026 self .active_result_set = self .backend .get_schemas (
@@ -1040,7 +1033,7 @@ def schemas(
10401033 )
10411034 return self
10421035
1043- @log_latency ()
1036+ @log_latency (StatementType . METADATA )
10441037 def tables (
10451038 self ,
10461039 catalog_name : Optional [str ] = None ,
@@ -1054,7 +1047,6 @@ def tables(
10541047 Names can contain % wildcards.
10551048 :returns self
10561049 """
1057- self .statement_type = StatementType .METADATA
10581050 self ._check_not_closed ()
10591051 self ._close_and_clear_active_result_set ()
10601052
@@ -1070,7 +1062,7 @@ def tables(
10701062 )
10711063 return self
10721064
1073- @log_latency ()
1065+ @log_latency (StatementType . METADATA )
10741066 def columns (
10751067 self ,
10761068 catalog_name : Optional [str ] = None ,
@@ -1084,7 +1076,6 @@ def columns(
10841076 Names can contain % wildcards.
10851077 :returns self
10861078 """
1087- self .statement_type = StatementType .METADATA
10881079 self ._check_not_closed ()
10891080 self ._close_and_clear_active_result_set ()
10901081
0 commit comments