Skip to content

Commit 09b2970

Browse files
committed
Change tracking arg name to track_rows_processed
1 parent 0d04574 commit 09b2970

File tree

14 files changed

+44
-44
lines changed

14 files changed

+44
-44
lines changed

sqlmesh/core/console.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4280,7 +4280,7 @@ def _calculate_annotation_str_len(
42804280
# Convert number of bytes to a human-readable string
42814281
# https://github.com/dbt-labs/dbt-adapters/blob/34fd178539dcb6f82e18e738adc03de7784c032f/dbt-bigquery/src/dbt/adapters/bigquery/connections.py#L165
42824282
def _format_bytes(num_bytes: t.Optional[int]) -> str:
4283-
if num_bytes and num_bytes > 0:
4283+
if num_bytes and num_bytes >= 0:
42844284
if num_bytes < 1024:
42854285
return f"{num_bytes} bytes"
42864286

@@ -4298,7 +4298,7 @@ def _format_bytes(num_bytes: t.Optional[int]) -> str:
42984298
# Abbreviate integer count. Example: 1,000,000,000 -> 1b
42994299
# https://github.com/dbt-labs/dbt-adapters/blob/34fd178539dcb6f82e18e738adc03de7784c032f/dbt-bigquery/src/dbt/adapters/bigquery/connections.py#L178
43004300
def _abbreviate_integer_count(count: t.Optional[int]) -> str:
4301-
if count and count > 0:
4301+
if count and count >= 0:
43024302
if count < 1000:
43034303
return str(count)
43044304

sqlmesh/core/engine_adapter/base.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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_execution_stats: bool = True,
840+
track_rows_processed: 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_execution_stats=track_execution_stats,
886+
track_rows_processed=track_rows_processed,
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_execution_stats=track_execution_stats,
894+
track_rows_processed=track_rows_processed,
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_execution_stats: bool = True,
918+
track_rows_processed: 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_execution_stats=track_execution_stats,
936+
track_rows_processed=track_rows_processed,
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_execution_stats: bool = True,
1411+
track_rows_processed: 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,15 +1418,15 @@ 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_execution_stats
1421+
table_name, source_queries, target_columns_to_types, track_rows_processed
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_execution_stats: bool = True,
1429+
track_rows_processed: 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)
@@ -1436,7 +1436,7 @@ def _insert_append_source_queries(
14361436
table_name,
14371437
query,
14381438
target_columns_to_types,
1439-
track_execution_stats=track_execution_stats,
1439+
track_rows_processed=track_rows_processed,
14401440
)
14411441

14421442
def _insert_append_query(
@@ -1445,13 +1445,13 @@ def _insert_append_query(
14451445
query: Query,
14461446
target_columns_to_types: t.Dict[str, exp.DataType],
14471447
order_projections: bool = True,
1448-
track_execution_stats: bool = True,
1448+
track_rows_processed: bool = True,
14491449
) -> None:
14501450
if order_projections:
14511451
query = self._order_projections_and_filter(query, target_columns_to_types)
14521452
self.execute(
14531453
exp.insert(query, table_name, columns=list(target_columns_to_types)),
1454-
track_execution_stats=track_execution_stats,
1454+
track_rows_processed=track_rows_processed,
14551455
)
14561456

14571457
def insert_overwrite_by_partition(
@@ -1594,7 +1594,7 @@ def _insert_overwrite_by_condition(
15941594
)
15951595
if insert_overwrite_strategy.is_replace_where:
15961596
insert_exp.set("where", where or exp.true())
1597-
self.execute(insert_exp, track_execution_stats=True)
1597+
self.execute(insert_exp, track_rows_processed=True)
15981598

15991599
def update_table(
16001600
self,
@@ -1616,7 +1616,7 @@ def _merge(
16161616
exp.Subquery(this=query), alias=MERGE_SOURCE_ALIAS, copy=False, table=True
16171617
)
16181618
self.execute(
1619-
exp.Merge(this=this, using=using, on=on, whens=whens), track_execution_stats=True
1619+
exp.Merge(this=this, using=using, on=on, whens=whens), track_rows_processed=True
16201620
)
16211621

16221622
def scd_type_2_by_time(
@@ -2366,7 +2366,7 @@ def execute(
23662366
expressions: t.Union[str, exp.Expression, t.Sequence[exp.Expression]],
23672367
ignore_unsupported_errors: bool = False,
23682368
quote_identifiers: bool = True,
2369-
track_execution_stats: bool = False,
2369+
track_rows_processed: bool = False,
23702370
**kwargs: t.Any,
23712371
) -> None:
23722372
"""Execute a sql query."""
@@ -2388,7 +2388,7 @@ def execute(
23882388
expression=e if isinstance(e, exp.Expression) else None,
23892389
quote_identifiers=quote_identifiers,
23902390
)
2391-
self._execute(sql, track_execution_stats, **kwargs)
2391+
self._execute(sql, track_rows_processed, **kwargs)
23922392

23932393
def _attach_correlation_id(self, sql: str) -> str:
23942394
if self.ATTACH_CORRELATION_ID and self.correlation_id:
@@ -2418,12 +2418,12 @@ def _record_execution_stats(
24182418
) -> None:
24192419
QueryExecutionTracker.record_execution(sql, rowcount, bytes_processed)
24202420

2421-
def _execute(self, sql: str, track_execution_stats: bool = False, **kwargs: t.Any) -> None:
2421+
def _execute(self, sql: str, track_rows_processed: bool = False, **kwargs: t.Any) -> None:
24222422
self.cursor.execute(sql, **kwargs)
24232423

24242424
if (
24252425
self.SUPPORTS_QUERY_EXECUTION_TRACKING
2426-
and track_execution_stats
2426+
and track_rows_processed
24272427
and QueryExecutionTracker.is_tracking()
24282428
):
24292429
rowcount_raw = getattr(self.cursor, "rowcount", None)
@@ -2480,7 +2480,7 @@ def temp_table(
24802480
exists=True,
24812481
table_description=None,
24822482
column_descriptions=None,
2483-
track_execution_stats=False,
2483+
track_rows_processed=False,
24842484
**kwargs,
24852485
)
24862486

@@ -2732,7 +2732,7 @@ def _replace_by_key(
27322732
insert_statement.set("where", delete_filter)
27332733
insert_statement.set("this", exp.to_table(target_table))
27342734

2735-
self.execute(insert_statement, track_execution_stats=True)
2735+
self.execute(insert_statement, track_rows_processed=True)
27362736
finally:
27372737
self.drop_table(temp_table)
27382738

sqlmesh/core/engine_adapter/bigquery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ def _db_call(self, func: t.Callable[..., t.Any], *args: t.Any, **kwargs: t.Any)
10511051
def _execute(
10521052
self,
10531053
sql: str,
1054-
track_execution_stats: bool = False,
1054+
track_rows_processed: bool = False,
10551055
**kwargs: t.Any,
10561056
) -> None:
10571057
"""Execute a sql query."""
@@ -1097,7 +1097,7 @@ def _execute(
10971097
self.cursor._set_rowcount(query_results)
10981098
self.cursor._set_description(query_results.schema)
10991099

1100-
if track_execution_stats and QueryExecutionTracker.is_tracking():
1100+
if track_rows_processed and QueryExecutionTracker.is_tracking():
11011101
num_rows = None
11021102
if query_job.statement_type == "CREATE_TABLE_AS_SELECT":
11031103
# since table was just created, number rows in table == number rows processed

sqlmesh/core/engine_adapter/clickhouse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def _insert_overwrite_by_condition(
294294
)
295295

296296
try:
297-
self.execute(existing_records_insert_exp, track_execution_stats=True)
297+
self.execute(existing_records_insert_exp, track_rows_processed=True)
298298
finally:
299299
if table_partition_exp:
300300
self.drop_table(partitions_temp_table_name)
@@ -489,7 +489,7 @@ def _create_table(
489489
table_description: t.Optional[str] = None,
490490
column_descriptions: t.Optional[t.Dict[str, str]] = None,
491491
table_kind: t.Optional[str] = None,
492-
track_execution_stats: bool = True,
492+
track_rows_processed: bool = True,
493493
**kwargs: t.Any,
494494
) -> None:
495495
"""Creates a table in the database.
@@ -526,7 +526,7 @@ def _create_table(
526526
column_descriptions,
527527
table_kind,
528528
empty_ctas=(self.engine_run_mode.is_cloud and expression is not None),
529-
track_execution_stats=track_execution_stats,
529+
track_rows_processed=track_rows_processed,
530530
**kwargs,
531531
)
532532

sqlmesh/core/engine_adapter/duckdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _create_table(
156156
table_description: t.Optional[str] = None,
157157
column_descriptions: t.Optional[t.Dict[str, str]] = None,
158158
table_kind: t.Optional[str] = None,
159-
track_execution_stats: bool = True,
159+
track_rows_processed: bool = True,
160160
**kwargs: t.Any,
161161
) -> None:
162162
catalog = self.get_current_catalog()
@@ -180,7 +180,7 @@ def _create_table(
180180
table_description,
181181
column_descriptions,
182182
table_kind,
183-
track_execution_stats=track_execution_stats,
183+
track_rows_processed=track_rows_processed,
184184
**kwargs,
185185
)
186186

sqlmesh/core/engine_adapter/redshift.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _create_table_from_source_queries(
174174
table_description: t.Optional[str] = None,
175175
column_descriptions: t.Optional[t.Dict[str, str]] = None,
176176
table_kind: t.Optional[str] = None,
177-
track_execution_stats: bool = True,
177+
track_rows_processed: bool = True,
178178
**kwargs: t.Any,
179179
) -> None:
180180
"""
@@ -429,7 +429,7 @@ def resolve_target_table(expression: exp.Expression) -> exp.Expression:
429429
on=on.transform(resolve_target_table),
430430
whens=whens.transform(resolve_target_table),
431431
),
432-
track_execution_stats=True,
432+
track_rows_processed=True,
433433
)
434434

435435
def _normalize_decimal_value(self, expr: exp.Expression, precision: int) -> exp.Expression:

sqlmesh/core/engine_adapter/snowflake.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _create_table(
169169
table_description: t.Optional[str] = None,
170170
column_descriptions: t.Optional[t.Dict[str, str]] = None,
171171
table_kind: t.Optional[str] = None,
172-
track_execution_stats: bool = True,
172+
track_rows_processed: bool = True,
173173
**kwargs: t.Any,
174174
) -> None:
175175
table_format = kwargs.get("table_format")
@@ -189,7 +189,7 @@ def _create_table(
189189
table_description=table_description,
190190
column_descriptions=column_descriptions,
191191
table_kind=table_kind,
192-
track_execution_stats=track_execution_stats,
192+
track_rows_processed=track_rows_processed,
193193
**kwargs,
194194
)
195195

sqlmesh/core/engine_adapter/spark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _create_table(
433433
table_description: t.Optional[str] = None,
434434
column_descriptions: t.Optional[t.Dict[str, str]] = None,
435435
table_kind: t.Optional[str] = None,
436-
track_execution_stats: bool = True,
436+
track_rows_processed: bool = True,
437437
**kwargs: t.Any,
438438
) -> None:
439439
table_name = (
@@ -462,7 +462,7 @@ def _create_table(
462462
target_columns_to_types=target_columns_to_types,
463463
table_description=table_description,
464464
column_descriptions=column_descriptions,
465-
track_execution_stats=track_execution_stats,
465+
track_rows_processed=track_rows_processed,
466466
**kwargs,
467467
)
468468
table_name = (

sqlmesh/core/engine_adapter/trino.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def _create_table(
358358
table_description: t.Optional[str] = None,
359359
column_descriptions: t.Optional[t.Dict[str, str]] = None,
360360
table_kind: t.Optional[str] = None,
361-
track_execution_stats: bool = True,
361+
track_rows_processed: bool = True,
362362
**kwargs: t.Any,
363363
) -> None:
364364
super()._create_table(
@@ -370,7 +370,7 @@ def _create_table(
370370
table_description=table_description,
371371
column_descriptions=column_descriptions,
372372
table_kind=table_kind,
373-
track_execution_stats=track_execution_stats,
373+
track_rows_processed=track_rows_processed,
374374
**kwargs,
375375
)
376376

sqlmesh/core/state_sync/db/environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def update_environment(self, environment: Environment) -> None:
7878
self.environments_table,
7979
_environment_to_df(environment),
8080
target_columns_to_types=self._environment_columns_to_types,
81-
track_execution_stats=False,
81+
track_rows_processed=False,
8282
)
8383

8484
def update_environment_statements(
@@ -109,7 +109,7 @@ def update_environment_statements(
109109
self.environment_statements_table,
110110
_environment_statements_to_df(environment_name, plan_id, environment_statements),
111111
target_columns_to_types=self._environment_statements_columns_to_types,
112-
track_execution_stats=False,
112+
track_rows_processed=False,
113113
)
114114

115115
def invalidate_environment(self, name: str, protect_prod: bool = True) -> None:

0 commit comments

Comments
 (0)