sqlmesh 0.200.1.dev19__py3-none-any.whl → 0.200.1.dev20__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.200.1.dev19'
21
- __version_tuple__ = version_tuple = (0, 200, 1, 'dev19')
20
+ __version__ = version = '0.200.1.dev20'
21
+ __version_tuple__ = version_tuple = (0, 200, 1, 'dev20')
sqlmesh/core/console.py CHANGED
@@ -289,11 +289,17 @@ class TableDiffConsole(abc.ABC):
289
289
 
290
290
  class BaseConsole(abc.ABC):
291
291
  @abc.abstractmethod
292
- def log_error(self, message: str) -> None:
292
+ def log_error(self, message: str, *args: t.Any, **kwargs: t.Any) -> None:
293
293
  """Display error info to the user."""
294
294
 
295
295
  @abc.abstractmethod
296
- def log_warning(self, short_message: str, long_message: t.Optional[str] = None) -> None:
296
+ def log_warning(
297
+ self,
298
+ short_message: str,
299
+ long_message: t.Optional[str] = None,
300
+ *args: t.Any,
301
+ **kwargs: t.Any,
302
+ ) -> None:
297
303
  """Display warning info to the user.
298
304
 
299
305
  Args:
@@ -3090,15 +3096,23 @@ class CaptureTerminalConsole(TerminalConsole):
3090
3096
  finally:
3091
3097
  self._errors = []
3092
3098
 
3093
- def log_warning(self, short_message: str, long_message: t.Optional[str] = None) -> None:
3099
+ def log_warning(
3100
+ self,
3101
+ short_message: str,
3102
+ long_message: t.Optional[str] = None,
3103
+ *args: t.Any,
3104
+ **kwargs: t.Any,
3105
+ ) -> None:
3094
3106
  if short_message not in self._warnings:
3095
3107
  self._warnings.append(short_message)
3096
- super().log_warning(short_message, long_message)
3108
+ if kwargs.pop("print", True):
3109
+ super().log_warning(short_message, long_message)
3097
3110
 
3098
- def log_error(self, message: str) -> None:
3111
+ def log_error(self, message: str, *args: t.Any, **kwargs: t.Any) -> None:
3099
3112
  if message not in self._errors:
3100
3113
  self._errors.append(message)
3101
- super().log_error(message)
3114
+ if kwargs.pop("print", True):
3115
+ super().log_error(message)
3102
3116
 
3103
3117
  def log_skipped_models(self, snapshot_names: t.Set[str]) -> None:
3104
3118
  if snapshot_names:
@@ -3135,6 +3149,11 @@ class MarkdownConsole(CaptureTerminalConsole):
3135
3149
  kwargs.pop("alert_block_collapsible_threshold", 200)
3136
3150
  )
3137
3151
 
3152
+ # capture_only = True: capture but dont print to console
3153
+ # capture_only = False: capture and also print to console
3154
+ self.warning_capture_only = kwargs.pop("warning_capture_only", False)
3155
+ self.error_capture_only = kwargs.pop("error_capture_only", False)
3156
+
3138
3157
  super().__init__(
3139
3158
  **{**kwargs, "console": RichConsole(no_color=True, width=kwargs.pop("width", None))}
3140
3159
  )
@@ -3409,6 +3428,12 @@ class MarkdownConsole(CaptureTerminalConsole):
3409
3428
  super().stop_promotion_progress(success)
3410
3429
  self._print("\n")
3411
3430
 
3431
+ def log_warning(self, short_message: str, long_message: t.Optional[str] = None) -> None:
3432
+ super().log_warning(short_message, long_message, print=not self.warning_capture_only)
3433
+
3434
+ def log_error(self, message: str) -> None:
3435
+ super().log_error(message, print=not self.error_capture_only)
3436
+
3412
3437
  def log_success(self, message: str) -> None:
3413
3438
  self._print(message)
3414
3439
 
@@ -3435,19 +3460,24 @@ class MarkdownConsole(CaptureTerminalConsole):
3435
3460
 
3436
3461
  def log_skipped_models(self, snapshot_names: t.Set[str]) -> None:
3437
3462
  if snapshot_names:
3438
- msg = " " + "\n ".join(snapshot_names)
3439
- self._print(f"**Skipped models**\n\n{msg}")
3463
+ self._print(f"**Skipped models**")
3464
+ for snapshot_name in snapshot_names:
3465
+ self._print(f"* `{snapshot_name}`")
3466
+ self._print("")
3440
3467
 
3441
3468
  def log_failed_models(self, errors: t.List[NodeExecutionFailedError]) -> None:
3442
3469
  if errors:
3443
- self._print("\n```\nFailed models\n")
3470
+ self._print("**Failed models**")
3444
3471
 
3445
3472
  error_messages = _format_node_errors(errors)
3446
3473
 
3447
3474
  for node_name, msg in error_messages.items():
3448
- self._print(f" **{node_name}**\n\n{msg}")
3475
+ self._print(f"* `{node_name}`\n")
3476
+ self._print(" ```")
3477
+ self._print(msg)
3478
+ self._print(" ```")
3449
3479
 
3450
- self._print("```\n")
3480
+ self._print("")
3451
3481
 
3452
3482
  def show_linter_violations(
3453
3483
  self, violations: t.List[RuleViolation], model: Model, is_error: bool = False
@@ -30,7 +30,7 @@ def github(ctx: click.Context, token: str) -> None:
30
30
  """Github Action CI/CD Bot. See https://sqlmesh.readthedocs.io/en/stable/integrations/github/ for details"""
31
31
  # set a larger width because if none is specified, it auto-detects 80 characters when running in GitHub Actions
32
32
  # which can result in surprise newlines when outputting dates to backfill
33
- set_console(MarkdownConsole(width=1000))
33
+ set_console(MarkdownConsole(width=1000, warning_capture_only=True, error_capture_only=True))
34
34
  ctx.obj["github"] = GithubController(
35
35
  paths=ctx.obj["paths"],
36
36
  token=token,
@@ -603,11 +603,11 @@ class GithubController:
603
603
 
604
604
  def _get_pr_environment_summary_failure(self, exception: t.Optional[Exception] = None) -> str:
605
605
  console_output = self._console.consume_captured_output()
606
+ failure_msg = ""
606
607
 
607
608
  if isinstance(exception, PlanError):
608
- failure_msg = f"Plan application failed.\n"
609
609
  if exception.args and (msg := exception.args[0]) and isinstance(msg, str):
610
- failure_msg += f"\n{msg}\n"
610
+ failure_msg += f"*{msg}*\n"
611
611
  if console_output:
612
612
  failure_msg += f"\n{console_output}"
613
613
  elif isinstance(exception, (SQLMeshError, SqlglotError, ValueError)):
@@ -713,6 +713,7 @@ class GithubController:
713
713
  Creates a PR environment from the logic present in the PR. If the PR contains changes that are
714
714
  uncategorized, then an error will be raised.
715
715
  """
716
+ self._console.consume_captured_output() # clear output buffer
716
717
  self._context.apply(self.pr_plan) # will raise if PR environment creation fails
717
718
 
718
719
  # update PR info comment
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.200.1.dev19
3
+ Version: 0.200.1.dev20
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=SOHAISeyY3qtH30N4aOOPbIi9trE7w0omXMhZqFV9dc,530
2
+ sqlmesh/_version.py,sha256=b3_7YvoVPBkWdbVnFLKanzRjgFeA9a1ORjd8-SPrzlg,530
3
3
  sqlmesh/magics.py,sha256=bEzYqXHcM0P3CjyUZ1O9arlmXAdLAhoglKbQ29fD9AE,41842
4
4
  sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -11,7 +11,7 @@ sqlmesh/cli/options.py,sha256=-4ZclMIeIg8tghLowtmQNmpEFlm0QtOVEh40NqRdFHA,2499
11
11
  sqlmesh/cli/project_init.py,sha256=5JmDmUK0WJs39hM-p76uzHYdo1Hnx6fKuJg_pR3Hn5A,16419
12
12
  sqlmesh/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  sqlmesh/core/_typing.py,sha256=e1f7xO2aZCy38M_3VoDy-XI3shyd99-IFctgIFSgXWM,497
14
- sqlmesh/core/console.py,sha256=g-xHXFAXhqrkqr_uADOgBtxSw2-96f5fo4YxF7irKq4,162837
14
+ sqlmesh/core/console.py,sha256=GQAWuxK8KZl6UclgPM51upiZXag9u8h1-HKotzjvblA,163884
15
15
  sqlmesh/core/constants.py,sha256=gUABXWYgH_XOSbaZAJsR5o1dmA61JDCvBDyxqqXX3LM,2630
16
16
  sqlmesh/core/context.py,sha256=GhR82ApxzgdDP9QN95vdKsOV7rAu8e9SVXvxw1dZExY,124800
17
17
  sqlmesh/core/context_diff.py,sha256=_Ur55fGLJ58Icsp44I4pVhdi7_JHiHq45mWIco9oFzk,21792
@@ -160,9 +160,9 @@ sqlmesh/integrations/llm.py,sha256=URgp3JKr06HYv6hGlJ7DQ9m3QCc41xRWK23HzmGpbDI,1
160
160
  sqlmesh/integrations/slack.py,sha256=nxLxu5WztGbZH3JdqnzyPqmJUMfRdJ_49LQ7zR-u39Q,6801
161
161
  sqlmesh/integrations/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  sqlmesh/integrations/github/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
163
- sqlmesh/integrations/github/cicd/command.py,sha256=yW0dmsnL-gFTzUvTX1RvCOXDcsOdi0M7IVCpsLR9IN8,12194
163
+ sqlmesh/integrations/github/cicd/command.py,sha256=w3oWhvR4utEurB5UABXj4iVBIojkCnZ0wTazIFmVmnc,12246
164
164
  sqlmesh/integrations/github/cicd/config.py,sha256=Cnk1xClYZpYuyCjj1cJnAdlqe0RObd6bg75dnmStEBA,3351
165
- sqlmesh/integrations/github/cicd/controller.py,sha256=8tFGVmPxdOl6rMj6X-50ZbzfgaQHVl2fa4QbVhr3WY4,53248
165
+ sqlmesh/integrations/github/cicd/controller.py,sha256=VhIpka7ZWB4BloAVUHy5dCpsPnhkFUtKDR9zGQjl2JU,53288
166
166
  sqlmesh/lsp/api.py,sha256=_lA_buSPZFIoLJuINbS53LbNOOaHp3orb0uFTE3aCqI,2328
167
167
  sqlmesh/lsp/completions.py,sha256=Nt1XpFL_-QAIRM8BBBC6Ia6YG0hMZriiNJra7nGfD4Q,6676
168
168
  sqlmesh/lsp/context.py,sha256=szHCrmKAjg4wDRnSbjRU158wSGx9HBRnNswSNw9N0Qc,12439
@@ -284,7 +284,7 @@ sqlmesh/utils/pydantic.py,sha256=o_NsXbIpDqNpUA1Uc5xF0ZzoXQYYB0DfHwdRxBwXPNk,120
284
284
  sqlmesh/utils/rich.py,sha256=BpB47G0-JcU41LkGkeGKroexj4NOV5fox4-GOIXPgIc,3545
285
285
  sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
286
286
  sqlmesh/utils/yaml.py,sha256=hvo5lmybYLcIx4p6CQwufS8X4MbwS60lEBnCmYJCXmU,2336
287
- sqlmesh-0.200.1.dev19.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
287
+ sqlmesh-0.200.1.dev20.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
288
288
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
289
289
  web/client/dist/index.html,sha256=DAv6ABGogw4xRLb0T_92WP_S7XWyqVhwBgGKWtuQwU4,5472
290
290
  web/client/dist/assets/Audits-BuHAmFO8.js,sha256=zbYUF6WdUGMbnMm01GMNPb7xAJwj-o5wMdL56vPo2qE,1041
@@ -402,8 +402,8 @@ web/server/api/endpoints/models.py,sha256=kwj0s7uve3iZSMfmjkoPVMFMeY1sD0peTeyrWf
402
402
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
403
403
  web/server/api/endpoints/plan.py,sha256=bbbY50W_2MsZSTxOHWMKz0tbIm75nsRSlPy8GI2fg9Q,9306
404
404
  web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
405
- sqlmesh-0.200.1.dev19.dist-info/METADATA,sha256=Ny0Zc2-k411vatccGqa-JIHmP1miLT84VvGm7zcDk5w,26679
406
- sqlmesh-0.200.1.dev19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
407
- sqlmesh-0.200.1.dev19.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
408
- sqlmesh-0.200.1.dev19.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
409
- sqlmesh-0.200.1.dev19.dist-info/RECORD,,
405
+ sqlmesh-0.200.1.dev20.dist-info/METADATA,sha256=I0Cq_NuQAQbNh2xP6DYzDYPlSWF7xhk29waLNAKr2r8,26679
406
+ sqlmesh-0.200.1.dev20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
407
+ sqlmesh-0.200.1.dev20.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
408
+ sqlmesh-0.200.1.dev20.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
409
+ sqlmesh-0.200.1.dev20.dist-info/RECORD,,