Skip to content

Commit d93d3a6

Browse files
committed
Add engine support flags
1 parent 6de0cc2 commit d93d3a6

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

sqlmesh/core/engine_adapter/athena.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class AthenaEngineAdapter(PandasNativeFetchDFSupportMixin, RowDiffMixin):
4545
# >>> self._execute('/* test */ DESCRIBE foo')
4646
# pyathena.error.OperationalError: FAILED: ParseException line 1:0 cannot recognize input near '/' '*' 'test'
4747
ATTACH_CORRELATION_ID = False
48+
SUPPORTS_QUERY_EXECUTION_TRACKING = True
4849

4950
def __init__(
5051
self, *args: t.Any, s3_warehouse_location: t.Optional[str] = None, **kwargs: t.Any

sqlmesh/core/engine_adapter/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ class EngineAdapter:
117117
QUOTE_IDENTIFIERS_IN_VIEWS = True
118118
MAX_IDENTIFIER_LENGTH: t.Optional[int] = None
119119
ATTACH_CORRELATION_ID = True
120-
# TODO: change to False
121-
SUPPORTS_QUERY_EXECUTION_TRACKING = True
120+
SUPPORTS_QUERY_EXECUTION_TRACKING = False
122121

123122
def __init__(
124123
self,

sqlmesh/core/engine_adapter/base_postgres.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class BasePostgresEngineAdapter(EngineAdapter):
2424
DEFAULT_BATCH_SIZE = 400
2525
COMMENT_CREATION_TABLE = CommentCreationTable.COMMENT_COMMAND_ONLY
2626
COMMENT_CREATION_VIEW = CommentCreationView.COMMENT_COMMAND_ONLY
27+
SUPPORTS_QUERY_EXECUTION_TRACKING = True
2728

2829
def columns(
2930
self, table_name: TableName, include_pseudo_columns: bool = False

sqlmesh/core/engine_adapter/bigquery.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class BigQueryEngineAdapter(InsertOverwriteWithMergeMixin, ClusteredByMixin, Row
6969
SUPPORTS_CLONING = True
7070
MAX_TABLE_COMMENT_LENGTH = 1024
7171
MAX_COLUMN_COMMENT_LENGTH = 1024
72+
SUPPORTS_QUERY_EXECUTION_TRACKING = True
7273

7374
SCHEMA_DIFFER = SchemaDiffer(
7475
compatible_types={
@@ -1097,7 +1098,13 @@ def _execute(
10971098
self.cursor._set_description(query_results.schema)
10981099

10991100
if track_row_count:
1100-
track_execution_record(sql, query_results.total_rows)
1101+
if query_job.statement_type == "CREATE_TABLE_AS_SELECT":
1102+
query_table = self.client.get_table(query_job.destination)
1103+
num_rows = query_table.num_rows
1104+
elif query_job.statement_type in ["INSERT", "DELETE", "MERGE", "UPDATE"]:
1105+
num_rows = query_job.num_dml_affected_rows
1106+
1107+
track_execution_record(sql, num_rows)
11011108

11021109
def _get_data_objects(
11031110
self, schema_name: SchemaName, object_names: t.Optional[t.Set[str]] = None

sqlmesh/core/engine_adapter/postgres.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class PostgresEngineAdapter(
3636
CURRENT_CATALOG_EXPRESSION = exp.column("current_catalog")
3737
SUPPORTS_REPLACE_TABLE = False
3838
MAX_IDENTIFIER_LENGTH = 63
39-
SUPPORTS_QUERY_EXECUTION_TRACKING = True
4039
SCHEMA_DIFFER = SchemaDiffer(
4140
parameterized_type_defaults={
4241
# DECIMAL without precision is "up to 131072 digits before the decimal point; up to 16383 digits after the decimal point"

0 commit comments

Comments
 (0)