@@ -845,7 +845,7 @@ def _create_table_from_source_queries(
845845 table_description : t .Optional [str ] = None ,
846846 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
847847 table_kind : t .Optional [str ] = None ,
848- track_row_count : bool = True ,
848+ track_execution_stats : bool = True ,
849849 ** kwargs : t .Any ,
850850 ) -> None :
851851 table = exp .to_table (table_name )
@@ -891,15 +891,15 @@ def _create_table_from_source_queries(
891891 replace = replace ,
892892 table_description = table_description ,
893893 table_kind = table_kind ,
894- track_row_count = track_row_count ,
894+ track_execution_stats = track_execution_stats ,
895895 ** kwargs ,
896896 )
897897 else :
898898 self ._insert_append_query (
899899 table_name ,
900900 query ,
901901 target_columns_to_types or self .columns (table ),
902- track_row_count = track_row_count ,
902+ track_execution_stats = track_execution_stats ,
903903 )
904904
905905 # Register comments with commands if the engine supports comments and we weren't able to
@@ -923,7 +923,7 @@ def _create_table(
923923 table_description : t .Optional [str ] = None ,
924924 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
925925 table_kind : t .Optional [str ] = None ,
926- track_row_count : bool = True ,
926+ track_execution_stats : bool = True ,
927927 ** kwargs : t .Any ,
928928 ) -> None :
929929 self .execute (
@@ -941,7 +941,7 @@ def _create_table(
941941 table_kind = table_kind ,
942942 ** kwargs ,
943943 ),
944- track_row_count = track_row_count ,
944+ track_execution_stats = track_execution_stats ,
945945 )
946946
947947 def _build_create_table_exp (
@@ -1429,7 +1429,7 @@ def insert_append(
14291429 table_name : TableName ,
14301430 query_or_df : QueryOrDF ,
14311431 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1432- track_row_count : bool = True ,
1432+ track_execution_stats : bool = True ,
14331433 source_columns : t .Optional [t .List [str ]] = None ,
14341434 ) -> None :
14351435 source_queries , target_columns_to_types = self ._get_source_queries_and_columns_to_types (
@@ -1439,22 +1439,25 @@ def insert_append(
14391439 source_columns = source_columns ,
14401440 )
14411441 self ._insert_append_source_queries (
1442- table_name , source_queries , target_columns_to_types , track_row_count
1442+ table_name , source_queries , target_columns_to_types , track_execution_stats
14431443 )
14441444
14451445 def _insert_append_source_queries (
14461446 self ,
14471447 table_name : TableName ,
14481448 source_queries : t .List [SourceQuery ],
14491449 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1450- track_row_count : bool = True ,
1450+ track_execution_stats : bool = True ,
14511451 ) -> None :
14521452 with self .transaction (condition = len (source_queries ) > 0 ):
14531453 target_columns_to_types = target_columns_to_types or self .columns (table_name )
14541454 for source_query in source_queries :
14551455 with source_query as query :
14561456 self ._insert_append_query (
1457- table_name , query , target_columns_to_types , track_row_count = track_row_count
1457+ table_name ,
1458+ query ,
1459+ target_columns_to_types ,
1460+ track_execution_stats = track_execution_stats ,
14581461 )
14591462
14601463 def _insert_append_query (
@@ -1463,13 +1466,13 @@ def _insert_append_query(
14631466 query : Query ,
14641467 target_columns_to_types : t .Dict [str , exp .DataType ],
14651468 order_projections : bool = True ,
1466- track_row_count : bool = True ,
1469+ track_execution_stats : bool = True ,
14671470 ) -> None :
14681471 if order_projections :
14691472 query = self ._order_projections_and_filter (query , target_columns_to_types )
14701473 self .execute (
14711474 exp .insert (query , table_name , columns = list (target_columns_to_types )),
1472- track_row_count = track_row_count ,
1475+ track_execution_stats = track_execution_stats ,
14731476 )
14741477
14751478 def insert_overwrite_by_partition (
@@ -1612,7 +1615,7 @@ def _insert_overwrite_by_condition(
16121615 )
16131616 if insert_overwrite_strategy .is_replace_where :
16141617 insert_exp .set ("where" , where or exp .true ())
1615- self .execute (insert_exp , track_row_count = True )
1618+ self .execute (insert_exp , track_execution_stats = True )
16161619
16171620 def update_table (
16181621 self ,
@@ -1633,7 +1636,9 @@ def _merge(
16331636 using = exp .alias_ (
16341637 exp .Subquery (this = query ), alias = MERGE_SOURCE_ALIAS , copy = False , table = True
16351638 )
1636- self .execute (exp .Merge (this = this , using = using , on = on , whens = whens ), track_row_count = True )
1639+ self .execute (
1640+ exp .Merge (this = this , using = using , on = on , whens = whens ), track_execution_stats = True
1641+ )
16371642
16381643 def scd_type_2_by_time (
16391644 self ,
@@ -2382,7 +2387,7 @@ def execute(
23822387 expressions : t .Union [str , exp .Expression , t .Sequence [exp .Expression ]],
23832388 ignore_unsupported_errors : bool = False ,
23842389 quote_identifiers : bool = True ,
2385- track_row_count : bool = False ,
2390+ track_execution_stats : bool = False ,
23862391 ** kwargs : t .Any ,
23872392 ) -> None :
23882393 """Execute a sql query."""
@@ -2404,7 +2409,7 @@ def execute(
24042409 expression = e if isinstance (e , exp .Expression ) else None ,
24052410 quote_identifiers = quote_identifiers ,
24062411 )
2407- self ._execute (sql , track_row_count , ** kwargs )
2412+ self ._execute (sql , track_execution_stats , ** kwargs )
24082413
24092414 def _attach_correlation_id (self , sql : str ) -> str :
24102415 if self .ATTACH_CORRELATION_ID and self .correlation_id :
@@ -2429,12 +2434,12 @@ def _log_sql(
24292434
24302435 logger .log (self ._execute_log_level , "Executing SQL: %s" , sql_to_log )
24312436
2432- def _execute (self , sql : str , track_row_count : bool = False , ** kwargs : t .Any ) -> None :
2437+ def _execute (self , sql : str , track_execution_stats : bool = False , ** kwargs : t .Any ) -> None :
24332438 self .cursor .execute (sql , ** kwargs )
24342439
24352440 if (
24362441 self .SUPPORTS_QUERY_EXECUTION_TRACKING
2437- and track_row_count
2442+ and track_execution_stats
24382443 and QueryExecutionTracker .is_tracking ()
24392444 ):
24402445 rowcount_raw = getattr (self .cursor , "rowcount" , None )
@@ -2445,7 +2450,7 @@ def _execute(self, sql: str, track_row_count: bool = False, **kwargs: t.Any) ->
24452450 except (TypeError , ValueError ):
24462451 pass
24472452
2448- QueryExecutionTracker .record_execution (sql , rowcount )
2453+ QueryExecutionTracker .record_execution (sql , rowcount , None )
24492454
24502455 @contextlib .contextmanager
24512456 def temp_table (
@@ -2491,7 +2496,7 @@ def temp_table(
24912496 exists = True ,
24922497 table_description = None ,
24932498 column_descriptions = None ,
2494- track_row_count = False ,
2499+ track_execution_stats = False ,
24952500 ** kwargs ,
24962501 )
24972502
@@ -2743,7 +2748,7 @@ def _replace_by_key(
27432748 insert_statement .set ("where" , delete_filter )
27442749 insert_statement .set ("this" , exp .to_table (target_table ))
27452750
2746- self .execute (insert_statement , track_row_count = True )
2751+ self .execute (insert_statement , track_execution_stats = True )
27472752 finally :
27482753 self .drop_table (temp_table )
27492754
0 commit comments