sqlmesh 0.197.1.dev10__py3-none-any.whl → 0.197.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlmesh/_version.py +2 -2
- sqlmesh/core/config/scheduler.py +1 -0
- sqlmesh/core/context.py +22 -39
- sqlmesh/core/context_diff.py +3 -1
- sqlmesh/core/dialect.py +1 -1
- sqlmesh/core/engine_adapter/athena.py +1 -1
- sqlmesh/core/engine_adapter/base.py +3 -9
- sqlmesh/core/model/definition.py +2 -2
- sqlmesh/core/plan/evaluator.py +3 -9
- sqlmesh/core/plan/explainer.py +1 -5
- sqlmesh/utils/__init__.py +0 -21
- sqlmesh/utils/date.py +0 -5
- sqlmesh/utils/jinja.py +1 -1
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/METADATA +2 -4
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/RECORD +19 -19
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/WHEEL +0 -0
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.197.1.dev10.dist-info → sqlmesh-0.197.2.dist-info}/top_level.txt +0 -0
sqlmesh/_version.py
CHANGED
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.197.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 197,
|
|
20
|
+
__version__ = version = '0.197.2'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 197, 2)
|
sqlmesh/core/config/scheduler.py
CHANGED
|
@@ -130,6 +130,7 @@ class BuiltInSchedulerConfig(_EngineAdapterStateSyncSchedulerConfig, BaseConfig)
|
|
|
130
130
|
def create_plan_evaluator(self, context: GenericContext) -> PlanEvaluator:
|
|
131
131
|
return BuiltInPlanEvaluator(
|
|
132
132
|
state_sync=context.state_sync,
|
|
133
|
+
snapshot_evaluator=context.snapshot_evaluator,
|
|
133
134
|
create_scheduler=context.create_scheduler,
|
|
134
135
|
default_catalog=context.default_catalog,
|
|
135
136
|
console=context.console,
|
sqlmesh/core/context.py
CHANGED
|
@@ -116,11 +116,12 @@ from sqlmesh.core.test import (
|
|
|
116
116
|
run_tests,
|
|
117
117
|
)
|
|
118
118
|
from sqlmesh.core.user import User
|
|
119
|
-
from sqlmesh.utils import UniqueKeyDict, Verbosity
|
|
119
|
+
from sqlmesh.utils import UniqueKeyDict, Verbosity
|
|
120
120
|
from sqlmesh.utils.concurrency import concurrent_apply_to_values
|
|
121
121
|
from sqlmesh.utils.dag import DAG
|
|
122
122
|
from sqlmesh.utils.date import (
|
|
123
123
|
TimeLike,
|
|
124
|
+
now_ds,
|
|
124
125
|
to_timestamp,
|
|
125
126
|
format_tz_datetime,
|
|
126
127
|
now_timestamp,
|
|
@@ -417,7 +418,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
417
418
|
self.config.get_state_connection(self.gateway) or self.connection_config
|
|
418
419
|
)
|
|
419
420
|
|
|
420
|
-
self.
|
|
421
|
+
self._snapshot_evaluator: t.Optional[SnapshotEvaluator] = None
|
|
421
422
|
|
|
422
423
|
self.console = get_console()
|
|
423
424
|
setattr(self.console, "dialect", self.config.dialect)
|
|
@@ -445,22 +446,18 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
445
446
|
self._engine_adapter = self.connection_config.create_engine_adapter()
|
|
446
447
|
return self._engine_adapter
|
|
447
448
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
if correlation_id not in self._snapshot_evaluators:
|
|
453
|
-
self._snapshot_evaluators[correlation_id] = SnapshotEvaluator(
|
|
449
|
+
@property
|
|
450
|
+
def snapshot_evaluator(self) -> SnapshotEvaluator:
|
|
451
|
+
if not self._snapshot_evaluator:
|
|
452
|
+
self._snapshot_evaluator = SnapshotEvaluator(
|
|
454
453
|
{
|
|
455
|
-
gateway: adapter.
|
|
456
|
-
log_level=logging.INFO, correlation_id=correlation_id
|
|
457
|
-
)
|
|
454
|
+
gateway: adapter.with_log_level(logging.INFO)
|
|
458
455
|
for gateway, adapter in self.engine_adapters.items()
|
|
459
456
|
},
|
|
460
457
|
ddl_concurrent_tasks=self.concurrent_tasks,
|
|
461
458
|
selected_gateway=self.selected_gateway,
|
|
462
459
|
)
|
|
463
|
-
return self.
|
|
460
|
+
return self._snapshot_evaluator
|
|
464
461
|
|
|
465
462
|
def execution_context(
|
|
466
463
|
self,
|
|
@@ -541,9 +538,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
541
538
|
|
|
542
539
|
return self.create_scheduler(snapshots)
|
|
543
540
|
|
|
544
|
-
def create_scheduler(
|
|
545
|
-
self, snapshots: t.Iterable[Snapshot], correlation_id: t.Optional[CorrelationId] = None
|
|
546
|
-
) -> Scheduler:
|
|
541
|
+
def create_scheduler(self, snapshots: t.Iterable[Snapshot]) -> Scheduler:
|
|
547
542
|
"""Creates the built-in scheduler.
|
|
548
543
|
|
|
549
544
|
Args:
|
|
@@ -554,7 +549,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
554
549
|
"""
|
|
555
550
|
return Scheduler(
|
|
556
551
|
snapshots,
|
|
557
|
-
self.snapshot_evaluator
|
|
552
|
+
self.snapshot_evaluator,
|
|
558
553
|
self.state_sync,
|
|
559
554
|
default_catalog=self.default_catalog,
|
|
560
555
|
max_workers=self.concurrent_tasks,
|
|
@@ -719,7 +714,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
719
714
|
NotificationEvent.RUN_START, environment=environment
|
|
720
715
|
)
|
|
721
716
|
analytics_run_id = analytics.collector.on_run_start(
|
|
722
|
-
engine_type=self.snapshot_evaluator
|
|
717
|
+
engine_type=self.snapshot_evaluator.adapter.dialect,
|
|
723
718
|
state_sync_type=self.state_sync.state_type(),
|
|
724
719
|
)
|
|
725
720
|
self._load_materializations()
|
|
@@ -1000,7 +995,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
1000
995
|
Returns:
|
|
1001
996
|
The rendered expression.
|
|
1002
997
|
"""
|
|
1003
|
-
execution_time = execution_time or
|
|
998
|
+
execution_time = execution_time or now_ds()
|
|
1004
999
|
|
|
1005
1000
|
model = self.get_model(model_or_snapshot, raise_if_missing=True)
|
|
1006
1001
|
|
|
@@ -1081,7 +1076,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
1081
1076
|
and not parent_snapshot.categorized
|
|
1082
1077
|
]
|
|
1083
1078
|
|
|
1084
|
-
df = self.snapshot_evaluator
|
|
1079
|
+
df = self.snapshot_evaluator.evaluate_and_fetch(
|
|
1085
1080
|
snapshot,
|
|
1086
1081
|
start=start,
|
|
1087
1082
|
end=end,
|
|
@@ -1593,12 +1588,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
1593
1588
|
default_catalog=self.default_catalog,
|
|
1594
1589
|
console=self.console,
|
|
1595
1590
|
)
|
|
1596
|
-
explainer.evaluate(
|
|
1597
|
-
plan.to_evaluatable(),
|
|
1598
|
-
snapshot_evaluator=self.snapshot_evaluator(
|
|
1599
|
-
correlation_id=CorrelationId.from_plan_id(plan.plan_id)
|
|
1600
|
-
),
|
|
1601
|
-
)
|
|
1591
|
+
explainer.evaluate(plan.to_evaluatable())
|
|
1602
1592
|
return
|
|
1603
1593
|
|
|
1604
1594
|
self.notification_target_manager.notify(
|
|
@@ -1912,7 +1902,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
1912
1902
|
)
|
|
1913
1903
|
|
|
1914
1904
|
return TableDiff(
|
|
1915
|
-
adapter=adapter.
|
|
1905
|
+
adapter=adapter.with_log_level(logger.getEffectiveLevel()),
|
|
1916
1906
|
source=source,
|
|
1917
1907
|
target=target,
|
|
1918
1908
|
on=on,
|
|
@@ -2121,7 +2111,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2121
2111
|
errors = []
|
|
2122
2112
|
skipped_count = 0
|
|
2123
2113
|
for snapshot in snapshots:
|
|
2124
|
-
for audit_result in self.snapshot_evaluator
|
|
2114
|
+
for audit_result in self.snapshot_evaluator.audit(
|
|
2125
2115
|
snapshot=snapshot,
|
|
2126
2116
|
start=start,
|
|
2127
2117
|
end=end,
|
|
@@ -2153,7 +2143,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2153
2143
|
self.console.log_status_update(f"Got {error.count} results, expected 0.")
|
|
2154
2144
|
if error.query:
|
|
2155
2145
|
self.console.show_sql(
|
|
2156
|
-
f"{error.query.sql(dialect=self.snapshot_evaluator
|
|
2146
|
+
f"{error.query.sql(dialect=self.snapshot_evaluator.adapter.dialect)}"
|
|
2157
2147
|
)
|
|
2158
2148
|
|
|
2159
2149
|
self.console.log_status_update("Done.")
|
|
@@ -2345,14 +2335,11 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2345
2335
|
|
|
2346
2336
|
def close(self) -> None:
|
|
2347
2337
|
"""Releases all resources allocated by this context."""
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2338
|
+
if self._snapshot_evaluator:
|
|
2339
|
+
self._snapshot_evaluator.close()
|
|
2351
2340
|
if self._state_sync:
|
|
2352
2341
|
self._state_sync.close()
|
|
2353
2342
|
|
|
2354
|
-
self._snapshot_evaluators.clear()
|
|
2355
|
-
|
|
2356
2343
|
def _run(
|
|
2357
2344
|
self,
|
|
2358
2345
|
environment: str,
|
|
@@ -2403,11 +2390,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2403
2390
|
|
|
2404
2391
|
def _apply(self, plan: Plan, circuit_breaker: t.Optional[t.Callable[[], bool]]) -> None:
|
|
2405
2392
|
self._scheduler.create_plan_evaluator(self).evaluate(
|
|
2406
|
-
plan.to_evaluatable(),
|
|
2407
|
-
snapshot_evaluator=self.snapshot_evaluator(
|
|
2408
|
-
correlation_id=CorrelationId.from_plan_id(plan.plan_id)
|
|
2409
|
-
),
|
|
2410
|
-
circuit_breaker=circuit_breaker,
|
|
2393
|
+
plan.to_evaluatable(), circuit_breaker=circuit_breaker
|
|
2411
2394
|
)
|
|
2412
2395
|
|
|
2413
2396
|
@python_api_analytics
|
|
@@ -2700,7 +2683,7 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2700
2683
|
)
|
|
2701
2684
|
|
|
2702
2685
|
# Remove the expired snapshots tables
|
|
2703
|
-
self.snapshot_evaluator
|
|
2686
|
+
self.snapshot_evaluator.cleanup(
|
|
2704
2687
|
target_snapshots=cleanup_targets,
|
|
2705
2688
|
on_complete=self.console.update_cleanup_progress,
|
|
2706
2689
|
)
|
sqlmesh/core/context_diff.py
CHANGED
|
@@ -84,7 +84,7 @@ class ContextDiff(PydanticModel):
|
|
|
84
84
|
"""Python dependencies."""
|
|
85
85
|
previous_environment_statements: t.List[EnvironmentStatements] = []
|
|
86
86
|
"""Previous environment statements."""
|
|
87
|
-
environment_statements: t.List[EnvironmentStatements]
|
|
87
|
+
environment_statements: t.List[EnvironmentStatements]
|
|
88
88
|
"""Environment statements."""
|
|
89
89
|
diff_rendered: bool = False
|
|
90
90
|
"""Whether the diff should compare raw vs rendered models"""
|
|
@@ -268,6 +268,7 @@ class ContextDiff(PydanticModel):
|
|
|
268
268
|
if not env:
|
|
269
269
|
raise SQLMeshError(f"Environment '{environment}' must exist for this operation.")
|
|
270
270
|
|
|
271
|
+
environment_statements = state_reader.get_environment_statements(environment)
|
|
271
272
|
snapshots = state_reader.get_snapshots(env.snapshots)
|
|
272
273
|
|
|
273
274
|
return ContextDiff(
|
|
@@ -288,6 +289,7 @@ class ContextDiff(PydanticModel):
|
|
|
288
289
|
previous_requirements=env.requirements,
|
|
289
290
|
requirements=env.requirements,
|
|
290
291
|
previous_environment_statements=[],
|
|
292
|
+
environment_statements=environment_statements,
|
|
291
293
|
previous_gateway_managed_virtual_layer=env.gateway_managed,
|
|
292
294
|
gateway_managed_virtual_layer=env.gateway_managed,
|
|
293
295
|
)
|
sqlmesh/core/dialect.py
CHANGED
|
@@ -878,7 +878,7 @@ def parse(
|
|
|
878
878
|
match = match_dialect and DIALECT_PATTERN.search(sql[:MAX_MODEL_DEFINITION_SIZE])
|
|
879
879
|
dialect = Dialect.get_or_raise(match.group(2) if match else default_dialect)
|
|
880
880
|
|
|
881
|
-
tokens = dialect.tokenize(sql)
|
|
881
|
+
tokens = dialect.tokenizer.tokenize(sql)
|
|
882
882
|
chunks: t.List[t.Tuple[t.List[Token], ChunkType]] = [([], ChunkType.SQL)]
|
|
883
883
|
total = len(tokens)
|
|
884
884
|
|
|
@@ -46,7 +46,7 @@ class AthenaEngineAdapter(PandasNativeFetchDFSupportMixin, RowDiffMixin):
|
|
|
46
46
|
self, *args: t.Any, s3_warehouse_location: t.Optional[str] = None, **kwargs: t.Any
|
|
47
47
|
):
|
|
48
48
|
# Need to pass s3_warehouse_location to the superclass so that it goes into _extra_config
|
|
49
|
-
# which means that EngineAdapter.
|
|
49
|
+
# which means that EngineAdapter.with_log_level() keeps this property when it makes a clone
|
|
50
50
|
super().__init__(*args, s3_warehouse_location=s3_warehouse_location, **kwargs)
|
|
51
51
|
self.s3_warehouse_location = s3_warehouse_location
|
|
52
52
|
|
|
@@ -39,7 +39,7 @@ from sqlmesh.core.engine_adapter.shared import (
|
|
|
39
39
|
)
|
|
40
40
|
from sqlmesh.core.model.kind import TimeColumn
|
|
41
41
|
from sqlmesh.core.schema_diff import SchemaDiffer
|
|
42
|
-
from sqlmesh.utils import columns_to_types_all_known, random_id
|
|
42
|
+
from sqlmesh.utils import columns_to_types_all_known, random_id
|
|
43
43
|
from sqlmesh.utils.connection_pool import create_connection_pool, ConnectionPool
|
|
44
44
|
from sqlmesh.utils.date import TimeLike, make_inclusive, to_time_column
|
|
45
45
|
from sqlmesh.utils.errors import (
|
|
@@ -123,7 +123,6 @@ class EngineAdapter:
|
|
|
123
123
|
pre_ping: bool = False,
|
|
124
124
|
pretty_sql: bool = False,
|
|
125
125
|
shared_connection: bool = False,
|
|
126
|
-
correlation_id: t.Optional[CorrelationId] = None,
|
|
127
126
|
**kwargs: t.Any,
|
|
128
127
|
):
|
|
129
128
|
self.dialect = dialect.lower() or self.DIALECT
|
|
@@ -145,21 +144,19 @@ class EngineAdapter:
|
|
|
145
144
|
self._pre_ping = pre_ping
|
|
146
145
|
self._pretty_sql = pretty_sql
|
|
147
146
|
self._multithreaded = multithreaded
|
|
148
|
-
self.correlation_id = correlation_id
|
|
149
147
|
|
|
150
|
-
def
|
|
148
|
+
def with_log_level(self, level: int) -> EngineAdapter:
|
|
151
149
|
adapter = self.__class__(
|
|
152
150
|
self._connection_pool,
|
|
153
151
|
dialect=self.dialect,
|
|
154
152
|
sql_gen_kwargs=self._sql_gen_kwargs,
|
|
155
153
|
default_catalog=self._default_catalog,
|
|
156
|
-
execute_log_level=
|
|
154
|
+
execute_log_level=level,
|
|
157
155
|
register_comments=self._register_comments,
|
|
158
156
|
null_connection=True,
|
|
159
157
|
multithreaded=self._multithreaded,
|
|
160
158
|
pretty_sql=self._pretty_sql,
|
|
161
159
|
**self._extra_config,
|
|
162
|
-
**kwargs,
|
|
163
160
|
)
|
|
164
161
|
|
|
165
162
|
return adapter
|
|
@@ -2214,9 +2211,6 @@ class EngineAdapter:
|
|
|
2214
2211
|
else:
|
|
2215
2212
|
sql = t.cast(str, e)
|
|
2216
2213
|
|
|
2217
|
-
if self.correlation_id:
|
|
2218
|
-
sql = f"/* {self.correlation_id} */ {sql}"
|
|
2219
|
-
|
|
2220
2214
|
self._log_sql(
|
|
2221
2215
|
sql,
|
|
2222
2216
|
expression=e if isinstance(e, exp.Expression) else None,
|
sqlmesh/core/model/definition.py
CHANGED
|
@@ -2431,7 +2431,7 @@ def _create_model(
|
|
|
2431
2431
|
if not issubclass(klass, SqlModel):
|
|
2432
2432
|
defaults.pop("optimize_query", None)
|
|
2433
2433
|
|
|
2434
|
-
statements
|
|
2434
|
+
statements = []
|
|
2435
2435
|
|
|
2436
2436
|
if "pre_statements" in kwargs:
|
|
2437
2437
|
statements.extend(kwargs["pre_statements"])
|
|
@@ -2453,7 +2453,7 @@ def _create_model(
|
|
|
2453
2453
|
statements.extend(property_values.expressions)
|
|
2454
2454
|
|
|
2455
2455
|
jinja_macro_references, used_variables = extract_macro_references_and_variables(
|
|
2456
|
-
*(gen(e
|
|
2456
|
+
*(gen(e) for e in statements)
|
|
2457
2457
|
)
|
|
2458
2458
|
|
|
2459
2459
|
if jinja_macros:
|
sqlmesh/core/plan/evaluator.py
CHANGED
|
@@ -49,10 +49,7 @@ logger = logging.getLogger(__name__)
|
|
|
49
49
|
class PlanEvaluator(abc.ABC):
|
|
50
50
|
@abc.abstractmethod
|
|
51
51
|
def evaluate(
|
|
52
|
-
self,
|
|
53
|
-
plan: EvaluatablePlan,
|
|
54
|
-
snapshot_evaluator: SnapshotEvaluator,
|
|
55
|
-
circuit_breaker: t.Optional[t.Callable[[], bool]] = None,
|
|
52
|
+
self, plan: EvaluatablePlan, circuit_breaker: t.Optional[t.Callable[[], bool]] = None
|
|
56
53
|
) -> None:
|
|
57
54
|
"""Evaluates a plan by pushing snapshots and backfilling data.
|
|
58
55
|
|
|
@@ -63,8 +60,6 @@ class PlanEvaluator(abc.ABC):
|
|
|
63
60
|
|
|
64
61
|
Args:
|
|
65
62
|
plan: The plan to evaluate.
|
|
66
|
-
snapshot_evaluator: The snapshot evaluator to use.
|
|
67
|
-
circuit_breaker: The circuit breaker to use.
|
|
68
63
|
"""
|
|
69
64
|
|
|
70
65
|
|
|
@@ -72,11 +67,13 @@ class BuiltInPlanEvaluator(PlanEvaluator):
|
|
|
72
67
|
def __init__(
|
|
73
68
|
self,
|
|
74
69
|
state_sync: StateSync,
|
|
70
|
+
snapshot_evaluator: SnapshotEvaluator,
|
|
75
71
|
create_scheduler: t.Callable[[t.Iterable[Snapshot]], Scheduler],
|
|
76
72
|
default_catalog: t.Optional[str],
|
|
77
73
|
console: t.Optional[Console] = None,
|
|
78
74
|
):
|
|
79
75
|
self.state_sync = state_sync
|
|
76
|
+
self.snapshot_evaluator = snapshot_evaluator
|
|
80
77
|
self.create_scheduler = create_scheduler
|
|
81
78
|
self.default_catalog = default_catalog
|
|
82
79
|
self.console = console or get_console()
|
|
@@ -85,12 +82,9 @@ class BuiltInPlanEvaluator(PlanEvaluator):
|
|
|
85
82
|
def evaluate(
|
|
86
83
|
self,
|
|
87
84
|
plan: EvaluatablePlan,
|
|
88
|
-
snapshot_evaluator: SnapshotEvaluator,
|
|
89
85
|
circuit_breaker: t.Optional[t.Callable[[], bool]] = None,
|
|
90
86
|
) -> None:
|
|
91
87
|
self._circuit_breaker = circuit_breaker
|
|
92
|
-
self.snapshot_evaluator = snapshot_evaluator
|
|
93
|
-
|
|
94
88
|
self.console.start_plan_evaluation(plan)
|
|
95
89
|
analytics.collector.on_plan_apply_start(
|
|
96
90
|
plan=plan,
|
sqlmesh/core/plan/explainer.py
CHANGED
|
@@ -20,7 +20,6 @@ from sqlmesh.core.snapshot.definition import (
|
|
|
20
20
|
from sqlmesh.utils import Verbosity, rich as srich, to_snake_case
|
|
21
21
|
from sqlmesh.utils.date import to_ts
|
|
22
22
|
from sqlmesh.utils.errors import SQLMeshError
|
|
23
|
-
from sqlmesh.core.snapshot.evaluator import SnapshotEvaluator
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
logger = logging.getLogger(__name__)
|
|
@@ -38,10 +37,7 @@ class PlanExplainer(PlanEvaluator):
|
|
|
38
37
|
self.console = console or get_console()
|
|
39
38
|
|
|
40
39
|
def evaluate(
|
|
41
|
-
self,
|
|
42
|
-
plan: EvaluatablePlan,
|
|
43
|
-
snapshot_evaluator: SnapshotEvaluator,
|
|
44
|
-
circuit_breaker: t.Optional[t.Callable[[], bool]] = None,
|
|
40
|
+
self, plan: EvaluatablePlan, circuit_breaker: t.Optional[t.Callable[[], bool]] = None
|
|
45
41
|
) -> None:
|
|
46
42
|
plan_stages = stages.build_plan_stages(plan, self.state_reader, self.default_catalog)
|
|
47
43
|
explainer_console = _get_explainer_console(
|
sqlmesh/utils/__init__.py
CHANGED
|
@@ -13,7 +13,6 @@ import traceback
|
|
|
13
13
|
import types
|
|
14
14
|
import typing as t
|
|
15
15
|
import uuid
|
|
16
|
-
from dataclasses import dataclass
|
|
17
16
|
from collections import defaultdict
|
|
18
17
|
from contextlib import contextmanager
|
|
19
18
|
from copy import deepcopy
|
|
@@ -383,23 +382,3 @@ def to_snake_case(name: str) -> str:
|
|
|
383
382
|
return "".join(
|
|
384
383
|
f"_{c.lower()}" if c.isupper() and idx != 0 else c.lower() for idx, c in enumerate(name)
|
|
385
384
|
)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
class JobType(Enum):
|
|
389
|
-
PLAN = "SQLMESH_PLAN"
|
|
390
|
-
RUN = "SQLMESH_RUN"
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
@dataclass(frozen=True)
|
|
394
|
-
class CorrelationId:
|
|
395
|
-
"""ID that is added to each query in order to identify the job that created it."""
|
|
396
|
-
|
|
397
|
-
job_type: JobType
|
|
398
|
-
job_id: str
|
|
399
|
-
|
|
400
|
-
def __str__(self) -> str:
|
|
401
|
-
return f"{self.job_type.value}: {self.job_id}"
|
|
402
|
-
|
|
403
|
-
@classmethod
|
|
404
|
-
def from_plan_id(cls, plan_id: str) -> CorrelationId:
|
|
405
|
-
return CorrelationId(JobType.PLAN, plan_id)
|
sqlmesh/utils/date.py
CHANGED
|
@@ -253,12 +253,8 @@ def date_dict(
|
|
|
253
253
|
|
|
254
254
|
for prefix, time_like in prefixes:
|
|
255
255
|
dt = to_datetime(time_like)
|
|
256
|
-
dtntz = dt.replace(tzinfo=None)
|
|
257
|
-
|
|
258
256
|
millis = to_timestamp(time_like)
|
|
259
|
-
|
|
260
257
|
kwargs[f"{prefix}_dt"] = dt
|
|
261
|
-
kwargs[f"{prefix}_dtntz"] = dtntz
|
|
262
258
|
kwargs[f"{prefix}_date"] = to_date(dt)
|
|
263
259
|
kwargs[f"{prefix}_ds"] = to_ds(time_like)
|
|
264
260
|
kwargs[f"{prefix}_ts"] = to_ts(dt)
|
|
@@ -266,7 +262,6 @@ def date_dict(
|
|
|
266
262
|
kwargs[f"{prefix}_epoch"] = millis / 1000
|
|
267
263
|
kwargs[f"{prefix}_millis"] = millis
|
|
268
264
|
kwargs[f"{prefix}_hour"] = dt.hour
|
|
269
|
-
|
|
270
265
|
return kwargs
|
|
271
266
|
|
|
272
267
|
|
sqlmesh/utils/jinja.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlmesh
|
|
3
|
-
Version: 0.197.
|
|
3
|
+
Version: 0.197.2
|
|
4
4
|
Summary: Next-generation data transformation framework
|
|
5
5
|
Author-email: "TobikoData Inc." <engineering@tobikodata.com>
|
|
6
6
|
License: Apache License
|
|
@@ -234,7 +234,7 @@ Requires-Dist: python-dotenv
|
|
|
234
234
|
Requires-Dist: requests
|
|
235
235
|
Requires-Dist: rich[jupyter]
|
|
236
236
|
Requires-Dist: ruamel.yaml
|
|
237
|
-
Requires-Dist: sqlglot[rs]~=26.
|
|
237
|
+
Requires-Dist: sqlglot[rs]~=26.31.0
|
|
238
238
|
Requires-Dist: tenacity
|
|
239
239
|
Requires-Dist: time-machine
|
|
240
240
|
Requires-Dist: json-stream
|
|
@@ -267,7 +267,6 @@ Requires-Dist: dbt-athena-community; extra == "dev"
|
|
|
267
267
|
Requires-Dist: dbt-clickhouse; extra == "dev"
|
|
268
268
|
Requires-Dist: dbt-databricks; extra == "dev"
|
|
269
269
|
Requires-Dist: dbt-redshift; extra == "dev"
|
|
270
|
-
Requires-Dist: dbt-sqlserver>=1.7.0; python_version < "3.13" and extra == "dev"
|
|
271
270
|
Requires-Dist: dbt-trino; extra == "dev"
|
|
272
271
|
Requires-Dist: Faker; extra == "dev"
|
|
273
272
|
Requires-Dist: google-auth; extra == "dev"
|
|
@@ -315,7 +314,6 @@ Provides-Extra: llm
|
|
|
315
314
|
Requires-Dist: langchain; extra == "llm"
|
|
316
315
|
Requires-Dist: openai; extra == "llm"
|
|
317
316
|
Provides-Extra: motherduck
|
|
318
|
-
Requires-Dist: duckdb>=1.2.0; extra == "motherduck"
|
|
319
317
|
Provides-Extra: mssql
|
|
320
318
|
Requires-Dist: pymssql; extra == "mssql"
|
|
321
319
|
Provides-Extra: mssql-odbc
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=3ZvjU_Cb0Qvxf6_LdBTmoquOr6908wZiIdTD4NznBIA,515
|
|
3
3
|
sqlmesh/magics.py,sha256=R9U0Mp9ZQhDYe751nxAQDLaMv3zLAR4HcTdIflKTmEE,41709
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -13,9 +13,9 @@ sqlmesh/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
sqlmesh/core/_typing.py,sha256=e1f7xO2aZCy38M_3VoDy-XI3shyd99-IFctgIFSgXWM,497
|
|
14
14
|
sqlmesh/core/console.py,sha256=_B9rmOn0WbgP8DsST8Lg9ODGu9u0WA2D2jRrJRX0VMM,153805
|
|
15
15
|
sqlmesh/core/constants.py,sha256=gUABXWYgH_XOSbaZAJsR5o1dmA61JDCvBDyxqqXX3LM,2630
|
|
16
|
-
sqlmesh/core/context.py,sha256=
|
|
17
|
-
sqlmesh/core/context_diff.py,sha256=
|
|
18
|
-
sqlmesh/core/dialect.py,sha256=
|
|
16
|
+
sqlmesh/core/context.py,sha256=a_t2RW9jmRfQ1UCV0gv7fGonNR3N94WYm9QlOAvhkpA,118540
|
|
17
|
+
sqlmesh/core/context_diff.py,sha256=CeUmMBJzN__98YohrtAiIYPIZI9mrGBk6bVADWBLUw8,21692
|
|
18
|
+
sqlmesh/core/dialect.py,sha256=h9bDZWbVs7SvIBGvlIAxqdWWFOwE2qzpzs7LwNQX7vc,49830
|
|
19
19
|
sqlmesh/core/environment.py,sha256=7DbJX0r5nZRU3LhcgIxbSV-JosQYDjAt3V5Wc2Fpns8,13005
|
|
20
20
|
sqlmesh/core/lineage.py,sha256=zjB0Zfamo2Fja2r5SSZPMbrEKTXr1WjozZPVqvxdybI,3143
|
|
21
21
|
sqlmesh/core/loader.py,sha256=98lSZMe6pJUx1gHkLeMLkkxOG9wgRlIQlK-qvk9DWgc,40530
|
|
@@ -54,12 +54,12 @@ sqlmesh/core/config/naming.py,sha256=KVGaxUgswoQajXR_cHFJvgkmEFcU1V182GkOH1SJxuE
|
|
|
54
54
|
sqlmesh/core/config/plan.py,sha256=wJEDfocMcKSMN0-5gVojjIcmJZ0376LJU3tkGMTm-Zc,1558
|
|
55
55
|
sqlmesh/core/config/root.py,sha256=tZxArC4kjPqrt43R9uErH_awwwNQVaNIaTAb-ot9WiU,15529
|
|
56
56
|
sqlmesh/core/config/run.py,sha256=rIK0QnN_vArrwps2TXGVEbvao2AnGZgzXo7EliJa42E,852
|
|
57
|
-
sqlmesh/core/config/scheduler.py,sha256=
|
|
57
|
+
sqlmesh/core/config/scheduler.py,sha256=k3BVMpy5ZrC05ZlyE3vec8ZGfTjUjWyfsKZtYgflbyA,7029
|
|
58
58
|
sqlmesh/core/config/ui.py,sha256=jsO-S6_d9NkLZGG5pT4mgKgxMF34KzkDociZAMvCX3U,278
|
|
59
59
|
sqlmesh/core/engine_adapter/__init__.py,sha256=two_WTs4UnSNp-fscJh8vOunJq0Xi37EuDuMjKsKuNE,2281
|
|
60
60
|
sqlmesh/core/engine_adapter/_typing.py,sha256=_63pYCThfC39UtPVHY3N0H6qJ1YBT32OqwwR3swolGM,1037
|
|
61
|
-
sqlmesh/core/engine_adapter/athena.py,sha256=
|
|
62
|
-
sqlmesh/core/engine_adapter/base.py,sha256=
|
|
61
|
+
sqlmesh/core/engine_adapter/athena.py,sha256=WBVAB_YzBJXdiqq51LTd2jmYoMtGrLmtsA8IrIFVnQ0,26199
|
|
62
|
+
sqlmesh/core/engine_adapter/base.py,sha256=9dMfOQtgjTi551xM9Lxm5FK4MUoopvzwwgHjjDFnpzw,103788
|
|
63
63
|
sqlmesh/core/engine_adapter/base_postgres.py,sha256=DOsOdCJyQAVfA9S0GznuH0J1bonMqYVP_yJLDYcxFYM,6772
|
|
64
64
|
sqlmesh/core/engine_adapter/bigquery.py,sha256=qJE8vHLKKAeWMvltmYaUvWS95jM_UEZ6UzYLlr58sGo,50424
|
|
65
65
|
sqlmesh/core/engine_adapter/clickhouse.py,sha256=LoPdm_s_s-ZxS1XJPA3Et0iOHeJ1LgqTAFbwBdiqE7A,34912
|
|
@@ -88,7 +88,7 @@ sqlmesh/core/model/__init__.py,sha256=C8GRZ53xuXEA9hQv3BQS9pNNyd9rZ06R_B96UYGhDu
|
|
|
88
88
|
sqlmesh/core/model/cache.py,sha256=csun0RJguHzKX6-qITcOs4fVP4f8_Ts8qiUVV4sHY6Q,7869
|
|
89
89
|
sqlmesh/core/model/common.py,sha256=PcQS3rHFNIXV_Z1dGwLQ7gLPbYVlrbWGGKAyc58-9Xk,17379
|
|
90
90
|
sqlmesh/core/model/decorator.py,sha256=wUUg5t0K559tV9Pqt6FE2EWXt5TPGb4wF2Yg4B4hX4w,9251
|
|
91
|
-
sqlmesh/core/model/definition.py,sha256=
|
|
91
|
+
sqlmesh/core/model/definition.py,sha256=QUxpnWAmUDKw8GfdISPgL_W4cYII8LrwOj4-49e8XgE,111143
|
|
92
92
|
sqlmesh/core/model/kind.py,sha256=_SBjhrTUrCGkmcsKmabbmBIe1s_6aMIEPEaQh0cDIok,36109
|
|
93
93
|
sqlmesh/core/model/meta.py,sha256=D9InI9M2-IXeb34vkXNQSLALL8xVXjZ_LXwI-Tqxm7I,21197
|
|
94
94
|
sqlmesh/core/model/schema.py,sha256=OClbAeA8LpW-IiSiLT_TlDWkEqmIIvSk0GXq8SWI-GQ,3443
|
|
@@ -96,8 +96,8 @@ sqlmesh/core/model/seed.py,sha256=a0M-1zY1gOkN5ph2GQyataEdBSCtq50YjeFk2LyvInI,50
|
|
|
96
96
|
sqlmesh/core/plan/__init__.py,sha256=NKSvM7ZBVjw9ho3J65M1wFvG3KURB8PJ0FHHLmtSF44,443
|
|
97
97
|
sqlmesh/core/plan/builder.py,sha256=g07h-NOsOr_4spnOrlQ4KrFjh3RmbvHSydEuSOsShNc,41416
|
|
98
98
|
sqlmesh/core/plan/definition.py,sha256=OxgbvkMGNdlvYF2BjFJt_lINsBw38Fq1IX25P8_Z_Z0,13734
|
|
99
|
-
sqlmesh/core/plan/evaluator.py,sha256=
|
|
100
|
-
sqlmesh/core/plan/explainer.py,sha256=
|
|
99
|
+
sqlmesh/core/plan/evaluator.py,sha256=DkpJ78R33_RBx5MVY13CcGU0x2-EcKWkcrETsjuyn10,20484
|
|
100
|
+
sqlmesh/core/plan/explainer.py,sha256=BEtww_UVa1gMkzL6-y2yrcy1EMQ8MbkElvO6L6s_TYU,12011
|
|
101
101
|
sqlmesh/core/plan/stages.py,sha256=5cvEbrQsw_cx1gayxwLRwkIehQPixrbUT9B4BbEOj3A,21972
|
|
102
102
|
sqlmesh/core/snapshot/__init__.py,sha256=Z5HTetNCZGoKF1WAKXk4LWL9dc8EC8lwS2O4TtoBmt4,1317
|
|
103
103
|
sqlmesh/core/snapshot/cache.py,sha256=bgqCR2hyf6r2A_8QP1EnXFK25gDX37-Zg0YeMuETWxg,3934
|
|
@@ -261,7 +261,7 @@ sqlmesh/migrations/v0081_update_partitioned_by.py,sha256=Rj9RDd7WBonbGfTJx3vAqSv
|
|
|
261
261
|
sqlmesh/migrations/v0082_warn_if_incorrectly_duplicated_statements.py,sha256=K-Z0ghTCFSZuAYzNSUXF4L8axihPemM15EOXHcqkK3s,2489
|
|
262
262
|
sqlmesh/migrations/v0083_use_sql_for_scd_time_data_type_data_hash.py,sha256=0r-SlncPec4TBpnQTeblPsiIjIOVKc10GjBVbFPGcFA,148
|
|
263
263
|
sqlmesh/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
264
|
-
sqlmesh/utils/__init__.py,sha256=
|
|
264
|
+
sqlmesh/utils/__init__.py,sha256=hyuWXItTP_-QNczx66UyjGRLjh9E0XGjxSo-SyLgXrk,11060
|
|
265
265
|
sqlmesh/utils/aws.py,sha256=krxyhrKtsMJDEjT567UbGZogjJ9JRHkvAV-Cg3FVndM,1062
|
|
266
266
|
sqlmesh/utils/cache.py,sha256=GITQ3sldwG4vlI0wKIDI7yOr1CND1EI3necAmeCEW8g,4743
|
|
267
267
|
sqlmesh/utils/concurrency.py,sha256=EMgEecfPFN9_2Wjz4TUksJngECGse7fnKVcLswkmhAk,9274
|
|
@@ -270,11 +270,11 @@ sqlmesh/utils/connection_pool.py,sha256=To1zr9d5MQOZ5im09jLQKO4DFmfzH6s_q75cEa1y
|
|
|
270
270
|
sqlmesh/utils/conversions.py,sha256=Ul8u6TzlKzFz_lVrUzFSzmJBKHUXOYe2e-xmkMXV084,406
|
|
271
271
|
sqlmesh/utils/cron.py,sha256=mHjXgrsD10Nq-XyRW3OK7eC5Y3KvDc-DitTQyji6Hjg,1828
|
|
272
272
|
sqlmesh/utils/dag.py,sha256=L_jwKf81wCySmt1TFs4vEKsrIHSOPTBhptlmv1bsSSg,7025
|
|
273
|
-
sqlmesh/utils/date.py,sha256=
|
|
273
|
+
sqlmesh/utils/date.py,sha256=xSX3HX3pGPg1-if_Ug11zqE1vg06cbKykeKzDKIxYLs,16133
|
|
274
274
|
sqlmesh/utils/errors.py,sha256=HtpLcs1IN0aq65G372flV9kqqJUULLC3Ci7wvgoBANk,5392
|
|
275
275
|
sqlmesh/utils/git.py,sha256=v1MD4Zwn52UBn_tTfoKn8SAPJVGC6SEFrJ4WEJFbgF0,1868
|
|
276
276
|
sqlmesh/utils/hashing.py,sha256=4Bi0NvRctBHzg58btNxXwSNgcvj8doIVVvOjJ40mHBg,512
|
|
277
|
-
sqlmesh/utils/jinja.py,sha256=
|
|
277
|
+
sqlmesh/utils/jinja.py,sha256=PAKOB6wA0POagP51Wrbgv6-Alr18WAwpL7kd9VPRNkE,27854
|
|
278
278
|
sqlmesh/utils/metaprogramming.py,sha256=ebN5p4Boi9VmsoNVsoUIaW3obgsrtZ6Gt1FlgbA-9xM,23126
|
|
279
279
|
sqlmesh/utils/migration.py,sha256=R7Ck6FX-LfcujGy7sgS0kDWlK-xAEBODr3gqIQ8gC08,835
|
|
280
280
|
sqlmesh/utils/pandas.py,sha256=FytTSLcRNtO0-YMvpoDBkkut3yoQJR9mBSKpif8lxug,2497
|
|
@@ -283,7 +283,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
283
283
|
sqlmesh/utils/rich.py,sha256=BpB47G0-JcU41LkGkeGKroexj4NOV5fox4-GOIXPgIc,3545
|
|
284
284
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
285
285
|
sqlmesh/utils/yaml.py,sha256=hvo5lmybYLcIx4p6CQwufS8X4MbwS60lEBnCmYJCXmU,2336
|
|
286
|
-
sqlmesh-0.197.
|
|
286
|
+
sqlmesh-0.197.2.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
287
287
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
288
288
|
web/client/dist/index.html,sha256=kNpFjWxt34Pf-P-cROtPWi3GNSVk6zqA3eoN9tlZXI0,5472
|
|
289
289
|
web/client/dist/assets/Audits-DKgXravk.js,sha256=SaVQhNlislD_yQc_KivO7SPi1JH0ts1GnDPD5Zssutw,1041
|
|
@@ -401,8 +401,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
401
401
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
402
402
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
403
403
|
web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
|
|
404
|
-
sqlmesh-0.197.
|
|
405
|
-
sqlmesh-0.197.
|
|
406
|
-
sqlmesh-0.197.
|
|
407
|
-
sqlmesh-0.197.
|
|
408
|
-
sqlmesh-0.197.
|
|
404
|
+
sqlmesh-0.197.2.dist-info/METADATA,sha256=KrlSrs6vRQWTGdlJHSq-C-a_jaxGP_6kvDd1jyWah4U,26601
|
|
405
|
+
sqlmesh-0.197.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
406
|
+
sqlmesh-0.197.2.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
407
|
+
sqlmesh-0.197.2.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
408
|
+
sqlmesh-0.197.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|