@@ -837,7 +837,7 @@ def _create_table_from_source_queries(
837837 table_description : t .Optional [str ] = None ,
838838 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
839839 table_kind : t .Optional [str ] = None ,
840- track_row_count : bool = True ,
840+ track_execution_stats : bool = True ,
841841 ** kwargs : t .Any ,
842842 ) -> None :
843843 table = exp .to_table (table_name )
@@ -883,15 +883,15 @@ def _create_table_from_source_queries(
883883 replace = replace ,
884884 table_description = table_description ,
885885 table_kind = table_kind ,
886- track_row_count = track_row_count ,
886+ track_execution_stats = track_execution_stats ,
887887 ** kwargs ,
888888 )
889889 else :
890890 self ._insert_append_query (
891891 table_name ,
892892 query ,
893893 target_columns_to_types or self .columns (table ),
894- track_row_count = track_row_count ,
894+ track_execution_stats = track_execution_stats ,
895895 )
896896
897897 # Register comments with commands if the engine supports comments and we weren't able to
@@ -915,7 +915,7 @@ def _create_table(
915915 table_description : t .Optional [str ] = None ,
916916 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
917917 table_kind : t .Optional [str ] = None ,
918- track_row_count : bool = True ,
918+ track_execution_stats : bool = True ,
919919 ** kwargs : t .Any ,
920920 ) -> None :
921921 self .execute (
@@ -933,7 +933,7 @@ def _create_table(
933933 table_kind = table_kind ,
934934 ** kwargs ,
935935 ),
936- track_row_count = track_row_count ,
936+ track_execution_stats = track_execution_stats ,
937937 )
938938
939939 def _build_create_table_exp (
@@ -1408,7 +1408,7 @@ def insert_append(
14081408 table_name : TableName ,
14091409 query_or_df : QueryOrDF ,
14101410 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1411- track_row_count : bool = True ,
1411+ track_execution_stats : bool = True ,
14121412 source_columns : t .Optional [t .List [str ]] = None ,
14131413 ) -> None :
14141414 source_queries , target_columns_to_types = self ._get_source_queries_and_columns_to_types (
@@ -1418,22 +1418,25 @@ def insert_append(
14181418 source_columns = source_columns ,
14191419 )
14201420 self ._insert_append_source_queries (
1421- table_name , source_queries , target_columns_to_types , track_row_count
1421+ table_name , source_queries , target_columns_to_types , track_execution_stats
14221422 )
14231423
14241424 def _insert_append_source_queries (
14251425 self ,
14261426 table_name : TableName ,
14271427 source_queries : t .List [SourceQuery ],
14281428 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1429- track_row_count : bool = True ,
1429+ track_execution_stats : bool = True ,
14301430 ) -> None :
14311431 with self .transaction (condition = len (source_queries ) > 0 ):
14321432 target_columns_to_types = target_columns_to_types or self .columns (table_name )
14331433 for source_query in source_queries :
14341434 with source_query as query :
14351435 self ._insert_append_query (
1436- table_name , query , target_columns_to_types , track_row_count = track_row_count
1436+ table_name ,
1437+ query ,
1438+ target_columns_to_types ,
1439+ track_execution_stats = track_execution_stats ,
14371440 )
14381441
14391442 def _insert_append_query (
@@ -1442,13 +1445,13 @@ def _insert_append_query(
14421445 query : Query ,
14431446 target_columns_to_types : t .Dict [str , exp .DataType ],
14441447 order_projections : bool = True ,
1445- track_row_count : bool = True ,
1448+ track_execution_stats : bool = True ,
14461449 ) -> None :
14471450 if order_projections :
14481451 query = self ._order_projections_and_filter (query , target_columns_to_types )
14491452 self .execute (
14501453 exp .insert (query , table_name , columns = list (target_columns_to_types )),
1451- track_row_count = track_row_count ,
1454+ track_execution_stats = track_execution_stats ,
14521455 )
14531456
14541457 def insert_overwrite_by_partition (
@@ -1591,7 +1594,7 @@ def _insert_overwrite_by_condition(
15911594 )
15921595 if insert_overwrite_strategy .is_replace_where :
15931596 insert_exp .set ("where" , where or exp .true ())
1594- self .execute (insert_exp , track_row_count = True )
1597+ self .execute (insert_exp , track_execution_stats = True )
15951598
15961599 def update_table (
15971600 self ,
@@ -1612,7 +1615,9 @@ def _merge(
16121615 using = exp .alias_ (
16131616 exp .Subquery (this = query ), alias = MERGE_SOURCE_ALIAS , copy = False , table = True
16141617 )
1615- self .execute (exp .Merge (this = this , using = using , on = on , whens = whens ), track_row_count = True )
1618+ self .execute (
1619+ exp .Merge (this = this , using = using , on = on , whens = whens ), track_execution_stats = True
1620+ )
16161621
16171622 def scd_type_2_by_time (
16181623 self ,
@@ -2361,7 +2366,7 @@ def execute(
23612366 expressions : t .Union [str , exp .Expression , t .Sequence [exp .Expression ]],
23622367 ignore_unsupported_errors : bool = False ,
23632368 quote_identifiers : bool = True ,
2364- track_row_count : bool = False ,
2369+ track_execution_stats : bool = False ,
23652370 ** kwargs : t .Any ,
23662371 ) -> None :
23672372 """Execute a sql query."""
@@ -2383,7 +2388,7 @@ def execute(
23832388 expression = e if isinstance (e , exp .Expression ) else None ,
23842389 quote_identifiers = quote_identifiers ,
23852390 )
2386- self ._execute (sql , track_row_count , ** kwargs )
2391+ self ._execute (sql , track_execution_stats , ** kwargs )
23872392
23882393 def _attach_correlation_id (self , sql : str ) -> str :
23892394 if self .ATTACH_CORRELATION_ID and self .correlation_id :
@@ -2408,12 +2413,12 @@ def _log_sql(
24082413
24092414 logger .log (self ._execute_log_level , "Executing SQL: %s" , sql_to_log )
24102415
2411- def _execute (self , sql : str , track_row_count : bool = False , ** kwargs : t .Any ) -> None :
2416+ def _execute (self , sql : str , track_execution_stats : bool = False , ** kwargs : t .Any ) -> None :
24122417 self .cursor .execute (sql , ** kwargs )
24132418
24142419 if (
24152420 self .SUPPORTS_QUERY_EXECUTION_TRACKING
2416- and track_row_count
2421+ and track_execution_stats
24172422 and QueryExecutionTracker .is_tracking ()
24182423 ):
24192424 rowcount_raw = getattr (self .cursor , "rowcount" , None )
@@ -2424,7 +2429,7 @@ def _execute(self, sql: str, track_row_count: bool = False, **kwargs: t.Any) ->
24242429 except (TypeError , ValueError ):
24252430 pass
24262431
2427- QueryExecutionTracker .record_execution (sql , rowcount )
2432+ QueryExecutionTracker .record_execution (sql , rowcount , None )
24282433
24292434 @contextlib .contextmanager
24302435 def temp_table (
@@ -2470,7 +2475,7 @@ def temp_table(
24702475 exists = True ,
24712476 table_description = None ,
24722477 column_descriptions = None ,
2473- track_row_count = False ,
2478+ track_execution_stats = False ,
24742479 ** kwargs ,
24752480 )
24762481
@@ -2722,7 +2727,7 @@ def _replace_by_key(
27222727 insert_statement .set ("where" , delete_filter )
27232728 insert_statement .set ("this" , exp .to_table (target_table ))
27242729
2725- self .execute (insert_statement , track_row_count = True )
2730+ self .execute (insert_statement , track_execution_stats = True )
27262731 finally :
27272732 self .drop_table (temp_table )
27282733
0 commit comments