sqlmesh 0.225.1.dev6__py3-none-any.whl → 0.225.1.dev8__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/__init__.py CHANGED
@@ -188,6 +188,7 @@ def configure_logging(
188
188
  write_to_file: bool = True,
189
189
  log_file_dir: t.Optional[t.Union[str, Path]] = None,
190
190
  ignore_warnings: bool = False,
191
+ log_level: t.Optional[t.Union[str, int]] = None,
191
192
  ) -> None:
192
193
  # Remove noisy grpc logs that are not useful for users
193
194
  os.environ["GRPC_VERBOSITY"] = os.environ.get("GRPC_VERBOSITY", "NONE")
@@ -195,8 +196,15 @@ def configure_logging(
195
196
  logger = logging.getLogger()
196
197
  debug = force_debug or debug_mode_enabled()
197
198
 
198
- # base logger needs to be the lowest level that we plan to log
199
- level = logging.DEBUG if debug else logging.INFO
199
+ if log_level is not None:
200
+ if isinstance(log_level, str):
201
+ level = logging._nameToLevel.get(log_level.upper()) or logging.INFO
202
+ else:
203
+ level = log_level
204
+ else:
205
+ # base logger needs to be the lowest level that we plan to log
206
+ level = logging.DEBUG if debug else logging.INFO
207
+
200
208
  logger.setLevel(level)
201
209
 
202
210
  if debug:
sqlmesh/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.225.1.dev6'
32
- __version_tuple__ = version_tuple = (0, 225, 1, 'dev6')
31
+ __version__ = version = '0.225.1.dev8'
32
+ __version_tuple__ = version_tuple = (0, 225, 1, 'dev8')
33
33
 
34
34
  __commit_id__ = commit_id = None
sqlmesh/core/context.py CHANGED
@@ -139,6 +139,7 @@ from sqlmesh.utils.errors import (
139
139
  )
140
140
  from sqlmesh.utils.config import print_config
141
141
  from sqlmesh.utils.jinja import JinjaMacroRegistry
142
+ from sqlmesh.utils.windows import IS_WINDOWS, fix_windows_path
142
143
 
143
144
  if t.TYPE_CHECKING:
144
145
  import pandas as pd
@@ -2590,12 +2591,15 @@ class GenericContext(BaseContext, t.Generic[C]):
2590
2591
  )
2591
2592
 
2592
2593
  def clear_caches(self) -> None:
2593
- for path in self.configs:
2594
- cache_path = path / c.CACHE
2595
- if cache_path.exists():
2596
- rmtree(cache_path)
2597
- if self.cache_dir.exists():
2598
- rmtree(self.cache_dir)
2594
+ paths_to_remove = [path / c.CACHE for path in self.configs]
2595
+ paths_to_remove.append(self.cache_dir)
2596
+
2597
+ if IS_WINDOWS:
2598
+ paths_to_remove = [fix_windows_path(path) for path in paths_to_remove]
2599
+
2600
+ for path in paths_to_remove:
2601
+ if path.exists():
2602
+ rmtree(path)
2599
2603
 
2600
2604
  if isinstance(self._state_sync, CachingStateSync):
2601
2605
  self._state_sync.clear_cache()
sqlmesh/utils/windows.py CHANGED
@@ -3,12 +3,22 @@ from pathlib import Path
3
3
 
4
4
  IS_WINDOWS = platform.system() == "Windows"
5
5
 
6
+ WINDOWS_LONGPATH_PREFIX = "\\\\?\\"
7
+
6
8
 
7
9
  def fix_windows_path(path: Path) -> Path:
8
10
  """
9
11
  Windows paths are limited to 260 characters: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
10
12
  Users can change this by updating a registry entry but we cant rely on that.
11
- We can quite commonly generate a cache file path that exceeds 260 characters which causes a FileNotFound error.
12
- If we prefix the path with "\\?\" then we can have paths up to 32,767 characters
13
+
14
+ SQLMesh quite commonly generates cache file paths that exceed 260 characters and thus cause a FileNotFound error.
15
+ If we prefix paths with "\\?\" then we can have paths up to 32,767 characters.
16
+
17
+ Note that this prefix also means that relative paths no longer work. From the above docs:
18
+ > Because you cannot use the "\\?\" prefix with a relative path, relative paths are always limited to a total of MAX_PATH characters.
19
+
20
+ So we also call path.resolve() to resolve the relative sections so that operations like `path.read_text()` continue to work
13
21
  """
14
- return Path("\\\\?\\" + str(path.absolute()))
22
+ if path.parts and not path.parts[0].startswith(WINDOWS_LONGPATH_PREFIX):
23
+ path = Path(WINDOWS_LONGPATH_PREFIX + str(path.absolute()))
24
+ return path.resolve()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.225.1.dev6
3
+ Version: 0.225.1.dev8
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
- sqlmesh/__init__.py,sha256=fmowCZrGGK_h-tC6CxvMe4eam1l-Z3za2MjMMsjUuBA,7700
2
- sqlmesh/_version.py,sha256=cbPo-m2yDld1JOQFBqmrSnWP3QZ3uy_dfPjNE2xHRhs,721
1
+ sqlmesh/__init__.py,sha256=v_spqQEhcnGaahp1yPvMqUIa6mhH3cs3Bc1CznxvCEA,7965
2
+ sqlmesh/_version.py,sha256=rV17A_kMcZz30psoLrPixPeM_oQ4cYwJfBa98nn_kwY,721
3
3
  sqlmesh/magics.py,sha256=xLh3u4eqpVrKRVN5KF3X84RPRqjygAB9AJP1TXwH8hg,42086
4
4
  sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,7 +13,7 @@ sqlmesh/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  sqlmesh/core/_typing.py,sha256=PzXxMYnORq18JhblAOUttms3zPJZzZpIbfFA_jgKYPA,498
14
14
  sqlmesh/core/console.py,sha256=MYpVlciUY6rUuoqXyKfXTxD6a4-Bw4-ooATUTj_VHGg,172830
15
15
  sqlmesh/core/constants.py,sha256=BuQk43vluUm7LfP9nKp5o9qRhqIenWF_LiLXO_t_53c,2699
16
- sqlmesh/core/context.py,sha256=AU9pj6TX38ghuEkR3AdS7DKHbyNg_8LPXw5h_N1HAWU,130775
16
+ sqlmesh/core/context.py,sha256=dgtgIabNtdhVPsQ-tUY5lwK-SnCQxqDdRNY6f3TVMgY,130941
17
17
  sqlmesh/core/context_diff.py,sha256=mxkJu0IthFMOlaQ_kcq5C09mlgkq2RQb-pG2rd-x_nA,21648
18
18
  sqlmesh/core/dialect.py,sha256=CnKcPj6BnREfu9Zn1OyS7hZ3ktnaX03ygOg91nADlTU,53029
19
19
  sqlmesh/core/environment.py,sha256=Kgs_gUEUI072mh0JJFWNRynrCxp1TzRHZhX_NWJRfXc,13142
@@ -236,14 +236,14 @@ sqlmesh/utils/pandas.py,sha256=FytTSLcRNtO0-YMvpoDBkkut3yoQJR9mBSKpif8lxug,2497
236
236
  sqlmesh/utils/process.py,sha256=vpXcpJ1eIbivs7gZdwTKSJI7OS6kKBebnaBzz75ykvs,2428
237
237
  sqlmesh/utils/pydantic.py,sha256=o_NsXbIpDqNpUA1Uc5xF0ZzoXQYYB0DfHwdRxBwXPNk,12089
238
238
  sqlmesh/utils/rich.py,sha256=cwQ5nJ6sgz64xHtoh6_ec7ReV5YpsOGhMtUJnwoRfEI,3549
239
- sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
239
+ sqlmesh/utils/windows.py,sha256=0F9RdpuuCoG5NiEDXvWlAGCiJ-59OjSAmgFF5wW05aY,1133
240
240
  sqlmesh/utils/yaml.py,sha256=KFBd7hsKNRTtRudGR7d410qUYffQv0EWRcDM8hVNNZg,3025
241
- sqlmesh-0.225.1.dev6.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
241
+ sqlmesh-0.225.1.dev8.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
242
242
  sqlmesh_dbt/__init__.py,sha256=awYS5y5mz-1NUmx6i5h5NSTJ7tidRl9NC0FAnFWSF6U,350
243
- sqlmesh_dbt/cli.py,sha256=cBRqdlc4w1TnPEi6WaPQap34qLRINnDv1BDlo4WSDf0,5420
243
+ sqlmesh_dbt/cli.py,sha256=eAeOZtHOikSDEZNI6hnZYJ-pja6ijFldRV4PeSzwYwU,5744
244
244
  sqlmesh_dbt/console.py,sha256=RwWLYnEZHzn9Xp-e2gbZvkdKbWbBLN146geI84mJitg,1132
245
245
  sqlmesh_dbt/error.py,sha256=1sPNU6Dik30DR9WTCvGp3ED-pzNmAA3LhP95BXb3ndI,1146
246
- sqlmesh_dbt/operations.py,sha256=eCvkJf89I8ptw-C8I5Tcb1eTwxDmd_NoPniiK8QD5UE,14136
246
+ sqlmesh_dbt/operations.py,sha256=QiCsz5NtD9XScc3t2ASjtnkyVg0tjiyWkIjp21d5MG4,14196
247
247
  sqlmesh_dbt/options.py,sha256=noB_qK4uGGi7Erqk1XkkMaFz5aUc6lp44wwn1Nv_LI4,737
248
248
  sqlmesh_dbt/selectors.py,sha256=nmVrFsC7CR2A24FdGTp5Wz7MuWreI-xLQTpOTy0H9K4,6543
249
249
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -363,8 +363,8 @@ web/server/api/endpoints/models.py,sha256=kwj0s7uve3iZSMfmjkoPVMFMeY1sD0peTeyrWf
363
363
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
364
364
  web/server/api/endpoints/plan.py,sha256=bbbY50W_2MsZSTxOHWMKz0tbIm75nsRSlPy8GI2fg9Q,9306
365
365
  web/server/api/endpoints/table_diff.py,sha256=8XTwgOh6QBbNy_hTM1JuHgRjbnie-pGPrphiW-FNLjQ,6058
366
- sqlmesh-0.225.1.dev6.dist-info/METADATA,sha256=2vaVsPHud_3yqooMm8nh9zcJbviLngOHvEmi_FVdOMU,26685
367
- sqlmesh-0.225.1.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
368
- sqlmesh-0.225.1.dev6.dist-info/entry_points.txt,sha256=sHAf6tQczIM8xZoduN4qaUjV7QEPVUUW_LCT8EDUMv4,155
369
- sqlmesh-0.225.1.dev6.dist-info/top_level.txt,sha256=RQ-33FPe2IgL0rgossAfJkCRtqslz9b7wFARqiWLC5Q,24
370
- sqlmesh-0.225.1.dev6.dist-info/RECORD,,
366
+ sqlmesh-0.225.1.dev8.dist-info/METADATA,sha256=6uEvh5kZJuvg6DUlb_5Cx54upb6DZI9RtDZ-Yz3HpWA,26685
367
+ sqlmesh-0.225.1.dev8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
368
+ sqlmesh-0.225.1.dev8.dist-info/entry_points.txt,sha256=sHAf6tQczIM8xZoduN4qaUjV7QEPVUUW_LCT8EDUMv4,155
369
+ sqlmesh-0.225.1.dev8.dist-info/top_level.txt,sha256=RQ-33FPe2IgL0rgossAfJkCRtqslz9b7wFARqiWLC5Q,24
370
+ sqlmesh-0.225.1.dev8.dist-info/RECORD,,
sqlmesh_dbt/cli.py CHANGED
@@ -78,6 +78,12 @@ resource_type_option = click.option(
78
78
  default=False,
79
79
  help="Display debug logging during dbt execution. Useful for debugging and making bug reports events to help when debugging.",
80
80
  )
81
+ @click.option(
82
+ "--log-level",
83
+ default="info",
84
+ type=click.Choice(["debug", "info", "warn", "error", "none"]),
85
+ help="Specify the minimum severity of events that are logged to the console and the log file.",
86
+ )
81
87
  @click.pass_context
82
88
  @cli_global_error_handler
83
89
  def dbt(
@@ -85,6 +91,7 @@ def dbt(
85
91
  profile: t.Optional[str] = None,
86
92
  target: t.Optional[str] = None,
87
93
  debug: bool = False,
94
+ log_level: t.Optional[str] = None,
88
95
  ) -> None:
89
96
  """
90
97
  An ELT tool for managing your SQL transformations and data models, powered by the SQLMesh engine.
@@ -97,7 +104,12 @@ def dbt(
97
104
  # we have a partially applied function here because subcommands might set extra options like --vars
98
105
  # that need to be known before we attempt to load the project
99
106
  ctx.obj = functools.partial(
100
- create, project_dir=Path.cwd(), profile=profile, target=target, debug=debug
107
+ create,
108
+ project_dir=Path.cwd(),
109
+ profile=profile,
110
+ target=target,
111
+ debug=debug,
112
+ log_level=log_level,
101
113
  )
102
114
 
103
115
  if not ctx.invoked_subcommand:
sqlmesh_dbt/operations.py CHANGED
@@ -237,6 +237,7 @@ def create(
237
237
  vars: t.Optional[t.Dict[str, t.Any]] = None,
238
238
  threads: t.Optional[int] = None,
239
239
  debug: bool = False,
240
+ log_level: t.Optional[str] = None,
240
241
  ) -> DbtOperations:
241
242
  with Progress(transient=True) as progress:
242
243
  # Indeterminate progress bar before SQLMesh import to provide feedback to the user that something is indeed happening
@@ -256,7 +257,7 @@ def create(
256
257
  while root_logger.hasHandlers():
257
258
  root_logger.removeHandler(root_logger.handlers[0])
258
259
 
259
- configure_logging(force_debug=debug)
260
+ configure_logging(force_debug=debug, log_level=log_level)
260
261
  set_console(DbtCliConsole())
261
262
 
262
263
  progress.update(load_task_id, description="Loading project", total=None)