@@ -856,7 +856,7 @@ def _create_table_from_source_queries(
856856 table_description : t .Optional [str ] = None ,
857857 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
858858 table_kind : t .Optional [str ] = None ,
859- track_row_count : bool = True ,
859+ track_execution_stats : bool = True ,
860860 ** kwargs : t .Any ,
861861 ) -> None :
862862 table = exp .to_table (table_name )
@@ -902,15 +902,15 @@ def _create_table_from_source_queries(
902902 replace = replace ,
903903 table_description = table_description ,
904904 table_kind = table_kind ,
905- track_row_count = track_row_count ,
905+ track_execution_stats = track_execution_stats ,
906906 ** kwargs ,
907907 )
908908 else :
909909 self ._insert_append_query (
910910 table_name ,
911911 query ,
912912 target_columns_to_types or self .columns (table ),
913- track_row_count = track_row_count ,
913+ track_execution_stats = track_execution_stats ,
914914 )
915915
916916 # Register comments with commands if the engine supports comments and we weren't able to
@@ -934,7 +934,7 @@ def _create_table(
934934 table_description : t .Optional [str ] = None ,
935935 column_descriptions : t .Optional [t .Dict [str , str ]] = None ,
936936 table_kind : t .Optional [str ] = None ,
937- track_row_count : bool = True ,
937+ track_execution_stats : bool = True ,
938938 ** kwargs : t .Any ,
939939 ) -> None :
940940 self .execute (
@@ -952,7 +952,7 @@ def _create_table(
952952 table_kind = table_kind ,
953953 ** kwargs ,
954954 ),
955- track_row_count = track_row_count ,
955+ track_execution_stats = track_execution_stats ,
956956 )
957957
958958 def _build_create_table_exp (
@@ -1440,7 +1440,7 @@ def insert_append(
14401440 table_name : TableName ,
14411441 query_or_df : QueryOrDF ,
14421442 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1443- track_row_count : bool = True ,
1443+ track_execution_stats : bool = True ,
14441444 source_columns : t .Optional [t .List [str ]] = None ,
14451445 ) -> None :
14461446 source_queries , target_columns_to_types = self ._get_source_queries_and_columns_to_types (
@@ -1450,22 +1450,25 @@ def insert_append(
14501450 source_columns = source_columns ,
14511451 )
14521452 self ._insert_append_source_queries (
1453- table_name , source_queries , target_columns_to_types , track_row_count
1453+ table_name , source_queries , target_columns_to_types , track_execution_stats
14541454 )
14551455
14561456 def _insert_append_source_queries (
14571457 self ,
14581458 table_name : TableName ,
14591459 source_queries : t .List [SourceQuery ],
14601460 target_columns_to_types : t .Optional [t .Dict [str , exp .DataType ]] = None ,
1461- track_row_count : bool = True ,
1461+ track_execution_stats : bool = True ,
14621462 ) -> None :
14631463 with self .transaction (condition = len (source_queries ) > 0 ):
14641464 target_columns_to_types = target_columns_to_types or self .columns (table_name )
14651465 for source_query in source_queries :
14661466 with source_query as query :
14671467 self ._insert_append_query (
1468- table_name , query , target_columns_to_types , track_row_count = track_row_count
1468+ table_name ,
1469+ query ,
1470+ target_columns_to_types ,
1471+ track_execution_stats = track_execution_stats ,
14691472 )
14701473
14711474 def _insert_append_query (
@@ -1474,13 +1477,13 @@ def _insert_append_query(
14741477 query : Query ,
14751478 target_columns_to_types : t .Dict [str , exp .DataType ],
14761479 order_projections : bool = True ,
1477- track_row_count : bool = True ,
1480+ track_execution_stats : bool = True ,
14781481 ) -> None :
14791482 if order_projections :
14801483 query = self ._order_projections_and_filter (query , target_columns_to_types )
14811484 self .execute (
14821485 exp .insert (query , table_name , columns = list (target_columns_to_types )),
1483- track_row_count = track_row_count ,
1486+ track_execution_stats = track_execution_stats ,
14841487 )
14851488
14861489 def insert_overwrite_by_partition (
@@ -1623,7 +1626,7 @@ def _insert_overwrite_by_condition(
16231626 )
16241627 if insert_overwrite_strategy .is_replace_where :
16251628 insert_exp .set ("where" , where or exp .true ())
1626- self .execute (insert_exp , track_row_count = True )
1629+ self .execute (insert_exp , track_execution_stats = True )
16271630
16281631 def update_table (
16291632 self ,
@@ -1644,7 +1647,9 @@ def _merge(
16441647 using = exp .alias_ (
16451648 exp .Subquery (this = query ), alias = MERGE_SOURCE_ALIAS , copy = False , table = True
16461649 )
1647- self .execute (exp .Merge (this = this , using = using , on = on , whens = whens ), track_row_count = True )
1650+ self .execute (
1651+ exp .Merge (this = this , using = using , on = on , whens = whens ), track_execution_stats = True
1652+ )
16481653
16491654 def scd_type_2_by_time (
16501655 self ,
@@ -2393,7 +2398,7 @@ def execute(
23932398 expressions : t .Union [str , exp .Expression , t .Sequence [exp .Expression ]],
23942399 ignore_unsupported_errors : bool = False ,
23952400 quote_identifiers : bool = True ,
2396- track_row_count : bool = False ,
2401+ track_execution_stats : bool = False ,
23972402 ** kwargs : t .Any ,
23982403 ) -> None :
23992404 """Execute a sql query."""
@@ -2415,7 +2420,7 @@ def execute(
24152420 expression = e if isinstance (e , exp .Expression ) else None ,
24162421 quote_identifiers = quote_identifiers ,
24172422 )
2418- self ._execute (sql , track_row_count , ** kwargs )
2423+ self ._execute (sql , track_execution_stats , ** kwargs )
24192424
24202425 def _attach_correlation_id (self , sql : str ) -> str :
24212426 if self .ATTACH_CORRELATION_ID and self .correlation_id :
@@ -2440,12 +2445,12 @@ def _log_sql(
24402445
24412446 logger .log (self ._execute_log_level , "Executing SQL: %s" , sql_to_log )
24422447
2443- def _execute (self , sql : str , track_row_count : bool = False , ** kwargs : t .Any ) -> None :
2448+ def _execute (self , sql : str , track_execution_stats : bool = False , ** kwargs : t .Any ) -> None :
24442449 self .cursor .execute (sql , ** kwargs )
24452450
24462451 if (
24472452 self .SUPPORTS_QUERY_EXECUTION_TRACKING
2448- and track_row_count
2453+ and track_execution_stats
24492454 and QueryExecutionTracker .is_tracking ()
24502455 ):
24512456 rowcount_raw = getattr (self .cursor , "rowcount" , None )
@@ -2456,7 +2461,7 @@ def _execute(self, sql: str, track_row_count: bool = False, **kwargs: t.Any) ->
24562461 except (TypeError , ValueError ):
24572462 pass
24582463
2459- QueryExecutionTracker .record_execution (sql , rowcount )
2464+ QueryExecutionTracker .record_execution (sql , rowcount , None )
24602465
24612466 @contextlib .contextmanager
24622467 def temp_table (
@@ -2502,7 +2507,7 @@ def temp_table(
25022507 exists = True ,
25032508 table_description = None ,
25042509 column_descriptions = None ,
2505- track_row_count = False ,
2510+ track_execution_stats = False ,
25062511 ** kwargs ,
25072512 )
25082513
@@ -2754,7 +2759,7 @@ def _replace_by_key(
27542759 insert_statement .set ("where" , delete_filter )
27552760 insert_statement .set ("this" , exp .to_table (target_table ))
27562761
2757- self .execute (insert_statement , track_row_count = True )
2762+ self .execute (insert_statement , track_execution_stats = True )
27582763 finally :
27592764 self .drop_table (temp_table )
27602765
0 commit comments