sqlmesh 0.189.3.dev11__py3-none-any.whl → 0.189.3.dev12__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 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.189.3.dev11'
21
- __version_tuple__ = version_tuple = (0, 189, 3, 'dev11')
20
+ __version__ = version = '0.189.3.dev12'
21
+ __version_tuple__ = version_tuple = (0, 189, 3, 'dev12')
@@ -20,6 +20,7 @@ class PlanConfig(BaseConfig):
20
20
  auto_apply: Whether to automatically apply the new plan after creation.
21
21
  use_finalized_state: Whether to compare against the latest finalized environment state, or to use
22
22
  whatever state the target environment is currently in.
23
+ always_recreate_environment: Whether to always recreate the target environment from the `create_from` environment.
23
24
  """
24
25
 
25
26
  forward_only: bool = False
@@ -30,3 +31,4 @@ class PlanConfig(BaseConfig):
30
31
  no_prompts: bool = True
31
32
  auto_apply: bool = False
32
33
  use_finalized_state: bool = False
34
+ always_recreate_environment: bool = False
sqlmesh/core/context.py CHANGED
@@ -1487,6 +1487,7 @@ class GenericContext(BaseContext, t.Generic[C]):
1487
1487
  or (backfill_models is not None and not backfill_models),
1488
1488
  ensure_finalized_snapshots=self.config.plan.use_finalized_state,
1489
1489
  diff_rendered=diff_rendered,
1490
+ always_recreate_environment=self.config.plan.always_recreate_environment,
1490
1491
  )
1491
1492
  modified_model_names = {
1492
1493
  *context_diff.modified_snapshots,
@@ -2628,6 +2629,7 @@ class GenericContext(BaseContext, t.Generic[C]):
2628
2629
  force_no_diff: bool = False,
2629
2630
  ensure_finalized_snapshots: bool = False,
2630
2631
  diff_rendered: bool = False,
2632
+ always_recreate_environment: bool = False,
2631
2633
  ) -> ContextDiff:
2632
2634
  environment = Environment.sanitize_name(environment)
2633
2635
  if force_no_diff:
@@ -2645,6 +2647,7 @@ class GenericContext(BaseContext, t.Generic[C]):
2645
2647
  environment_statements=self._environment_statements,
2646
2648
  gateway_managed_virtual_layer=self.config.gateway_managed_virtual_layer,
2647
2649
  infer_python_dependencies=self.config.infer_python_dependencies,
2650
+ always_recreate_environment=always_recreate_environment,
2648
2651
  )
2649
2652
 
2650
2653
  def _destroy(self) -> None:
@@ -103,6 +103,7 @@ class ContextDiff(PydanticModel):
103
103
  environment_statements: t.Optional[t.List[EnvironmentStatements]] = [],
104
104
  gateway_managed_virtual_layer: bool = False,
105
105
  infer_python_dependencies: bool = True,
106
+ always_recreate_environment: bool = False,
106
107
  ) -> ContextDiff:
107
108
  """Create a ContextDiff object.
108
109
 
@@ -128,10 +129,12 @@ class ContextDiff(PydanticModel):
128
129
  The ContextDiff object.
129
130
  """
130
131
  environment = environment.lower()
131
- env = state_reader.get_environment(environment)
132
-
132
+ existing_env = state_reader.get_environment(environment)
133
133
  create_from_env_exists = False
134
- if env is None or env.expired:
134
+
135
+ recreate_environment = always_recreate_environment and not environment == create_from
136
+
137
+ if existing_env is None or existing_env.expired or recreate_environment:
135
138
  env = state_reader.get_environment(create_from.lower())
136
139
 
137
140
  if not env and create_from != c.PROD:
@@ -143,6 +146,7 @@ class ContextDiff(PydanticModel):
143
146
  create_from_env_exists = env is not None
144
147
  previously_promoted_snapshot_ids = set()
145
148
  else:
149
+ env = existing_env
146
150
  is_new_environment = False
147
151
  previously_promoted_snapshot_ids = {s.snapshot_id for s in env.promoted_snapshots}
148
152
 
@@ -220,6 +224,11 @@ class ContextDiff(PydanticModel):
220
224
 
221
225
  previous_environment_statements = state_reader.get_environment_statements(environment)
222
226
 
227
+ if existing_env and always_recreate_environment:
228
+ previous_plan_id: t.Optional[str] = existing_env.plan_id
229
+ else:
230
+ previous_plan_id = env.plan_id if env and not is_new_environment else None
231
+
223
232
  return ContextDiff(
224
233
  environment=environment,
225
234
  is_new_environment=is_new_environment,
@@ -232,7 +241,7 @@ class ContextDiff(PydanticModel):
232
241
  modified_snapshots=modified_snapshots,
233
242
  snapshots=merged_snapshots,
234
243
  new_snapshots=new_snapshots,
235
- previous_plan_id=env.plan_id if env and not is_new_environment else None,
244
+ previous_plan_id=previous_plan_id,
236
245
  previously_promoted_snapshot_ids=previously_promoted_snapshot_ids,
237
246
  previous_finalized_snapshots=env.previous_finalized_snapshots if env else None,
238
247
  previous_requirements=env.requirements if env else {},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.189.3.dev11
3
+ Version: 0.189.3.dev12
4
4
  Summary: Next-generation data transformation framework
5
5
  Author-email: "TobikoData Inc." <engineering@tobikodata.com>
6
6
  License: Apache License
@@ -1,5 +1,5 @@
1
1
  sqlmesh/__init__.py,sha256=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
2
- sqlmesh/_version.py,sha256=GGHauvJDXUWxx9Mql_BmbVfuHXfzF2PjlQHe88K7IrE,530
2
+ sqlmesh/_version.py,sha256=P3wEdhgoz6BF2ozBjdqSJX_la0iQ4tTkdPCZEUdTQ74,530
3
3
  sqlmesh/magics.py,sha256=gjzoxREb1XT8Yho_PQMlMqhhkLq_sEfBM8S3PTgxvWE,40337
4
4
  sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,8 +13,8 @@ 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=x7qWETjHgu8ZpMtfW8V3bGKByT4nZXDjgtO6xmvAb-I,151143
15
15
  sqlmesh/core/constants.py,sha256=oqt6zjepUhQoWlgapKn_HpG7Pu9mrFwepdX5caNfJUI,2499
16
- sqlmesh/core/context.py,sha256=u05rMOVPd8LvpTRrs6W5IiyT7cdjtHDIXBGqIthwFRI,117732
17
- sqlmesh/core/context_diff.py,sha256=I7luvY2za30E5ynVaFPaEQQEmNViJpWAmW48PGSyDCU,21135
16
+ sqlmesh/core/context.py,sha256=kWKYcmcdZBQI2bE3bVcsZDCQvO68Kty6uSvIfL2nnC0,117938
17
+ sqlmesh/core/context_diff.py,sha256=TCzM8egBE35DskpouOB-GQM2Qf5iUHWbRgiB5yZ6tzg,21552
18
18
  sqlmesh/core/dialect.py,sha256=93cXYVuNoZ9CvJNTVn2Yz7WDOdHINwVXflbn0eZ-p14,49764
19
19
  sqlmesh/core/environment.py,sha256=bNj-JCG_l13dwrp--YPIuGNsuWLTMLcFA5sY8IazVK8,12917
20
20
  sqlmesh/core/lineage.py,sha256=zjB0Zfamo2Fja2r5SSZPMbrEKTXr1WjozZPVqvxdybI,3143
@@ -51,7 +51,7 @@ sqlmesh/core/config/loader.py,sha256=Jcxp5Y6fCqg_BFQ03h9XVWhEQKESy5e2pomjvxh2Qa8
51
51
  sqlmesh/core/config/migration.py,sha256=3lZIlmIcQH3_hIEm3Y3jFtvpw0YXzRzAnk4OdiklO6M,408
52
52
  sqlmesh/core/config/model.py,sha256=GIz9kAfKD2NEXNzCZCQ17-CK2OtqN6WgeG1fvibcChM,3650
53
53
  sqlmesh/core/config/naming.py,sha256=KVGaxUgswoQajXR_cHFJvgkmEFcU1V182GkOH1SJxuE,326
54
- sqlmesh/core/config/plan.py,sha256=Sql_bdO2H_vVrIYosf8rWOTRVoMURciX7mEcbMNFFdg,1389
54
+ sqlmesh/core/config/plan.py,sha256=wJEDfocMcKSMN0-5gVojjIcmJZ0376LJU3tkGMTm-Zc,1558
55
55
  sqlmesh/core/config/root.py,sha256=Ytu5Evj4vtqouEIqQ4LkhZLc354P8qpOwrXkunTS6Tg,14907
56
56
  sqlmesh/core/config/run.py,sha256=rIK0QnN_vArrwps2TXGVEbvao2AnGZgzXo7EliJa42E,852
57
57
  sqlmesh/core/config/scheduler.py,sha256=k3BVMpy5ZrC05ZlyE3vec8ZGfTjUjWyfsKZtYgflbyA,7029
@@ -274,7 +274,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
274
274
  sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
275
275
  sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
276
276
  sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
277
- sqlmesh-0.189.3.dev11.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
277
+ sqlmesh-0.189.3.dev12.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
278
278
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
279
279
  web/client/dist/index.html,sha256=OVPMTMsqC8zy0qnBcMb7PpVcqTHdIJoCmJLYh7gC1Xs,5472
280
280
  web/client/dist/assets/Audits-Bvr7M5Cg.js,sha256=GrigkyEVYbM5zy0PAjOXdqmVV0kL-STP5gFQmx35vhw,1041
@@ -392,8 +392,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
392
392
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
393
393
  web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
394
394
  web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
395
- sqlmesh-0.189.3.dev11.dist-info/METADATA,sha256=k4YFGazCi4pyHe5ALEQ-INtBSbOkCj547_720DlYtpA,26541
396
- sqlmesh-0.189.3.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
397
- sqlmesh-0.189.3.dev11.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
398
- sqlmesh-0.189.3.dev11.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
399
- sqlmesh-0.189.3.dev11.dist-info/RECORD,,
395
+ sqlmesh-0.189.3.dev12.dist-info/METADATA,sha256=6MTTCr5Zgjo9PUbtUCib-NgyTR1MFs0EuFF7X3LluXk,26541
396
+ sqlmesh-0.189.3.dev12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
397
+ sqlmesh-0.189.3.dev12.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
398
+ sqlmesh-0.189.3.dev12.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
399
+ sqlmesh-0.189.3.dev12.dist-info/RECORD,,