sqlmesh 0.211.2.dev1__py3-none-any.whl → 0.211.2.dev2__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-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/METADATA +1 -1
- {sqlmesh-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/RECORD +10 -10
- sqlmesh_dbt/cli.py +13 -2
- sqlmesh_dbt/operations.py +7 -2
- sqlmesh_dbt/selectors.py +13 -7
- {sqlmesh-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/WHEEL +0 -0
- {sqlmesh-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.211.2.dev1.dist-info → sqlmesh-0.211.2.dev2.dist-info}/top_level.txt +0 -0
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.211.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 211, 2, '
|
|
31
|
+
__version__ = version = '0.211.2.dev2'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 211, 2, 'dev2')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -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=_SX7vdymMYLUIT2uNWUZp-U7rXKSg-_tOmix0J3KAwA,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
|
|
@@ -294,14 +294,14 @@ sqlmesh/utils/pydantic.py,sha256=o_NsXbIpDqNpUA1Uc5xF0ZzoXQYYB0DfHwdRxBwXPNk,120
|
|
|
294
294
|
sqlmesh/utils/rich.py,sha256=cwQ5nJ6sgz64xHtoh6_ec7ReV5YpsOGhMtUJnwoRfEI,3549
|
|
295
295
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
296
296
|
sqlmesh/utils/yaml.py,sha256=hvo5lmybYLcIx4p6CQwufS8X4MbwS60lEBnCmYJCXmU,2336
|
|
297
|
-
sqlmesh-0.211.2.
|
|
297
|
+
sqlmesh-0.211.2.dev2.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
298
298
|
sqlmesh_dbt/__init__.py,sha256=awYS5y5mz-1NUmx6i5h5NSTJ7tidRl9NC0FAnFWSF6U,350
|
|
299
|
-
sqlmesh_dbt/cli.py,sha256=
|
|
299
|
+
sqlmesh_dbt/cli.py,sha256=wSShIx02GCYz0Ciq808GbbO9tjXYkaM6U6SFoT7rmpA,4117
|
|
300
300
|
sqlmesh_dbt/console.py,sha256=80sCEbrKfR5f3SvxIyI7hw_SuiDiiUwuJYxXbQO2014,830
|
|
301
301
|
sqlmesh_dbt/error.py,sha256=khi7UM_nqH4T47QL0NQbiXUvpr15Amh0F-Rtt4Xov20,885
|
|
302
|
-
sqlmesh_dbt/operations.py,sha256=
|
|
302
|
+
sqlmesh_dbt/operations.py,sha256=EON-uSJaLkjh_uyhHAiRWdT1yuD2SqZq5CnepmJmZZU,5584
|
|
303
303
|
sqlmesh_dbt/options.py,sha256=noB_qK4uGGi7Erqk1XkkMaFz5aUc6lp44wwn1Nv_LI4,737
|
|
304
|
-
sqlmesh_dbt/selectors.py,sha256=
|
|
304
|
+
sqlmesh_dbt/selectors.py,sha256=4w8eE0qAgoYC2K8afk3whfju-u3e5muXGwgkfXxQR3Y,5228
|
|
305
305
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
306
306
|
web/client/dist/index.html,sha256=9Xh9IRDTAsC-XXYlaB1dLXv3dv15cDXnW2qz1z-Dj98,5472
|
|
307
307
|
web/client/dist/assets/Audits-Ucsx1GzF.js,sha256=fZhFbeOvI1RlQt7dBwG-GLDt5SBbCdbTY0i4zfXFGwE,1041
|
|
@@ -419,8 +419,8 @@ web/server/api/endpoints/models.py,sha256=kwj0s7uve3iZSMfmjkoPVMFMeY1sD0peTeyrWf
|
|
|
419
419
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
420
420
|
web/server/api/endpoints/plan.py,sha256=bbbY50W_2MsZSTxOHWMKz0tbIm75nsRSlPy8GI2fg9Q,9306
|
|
421
421
|
web/server/api/endpoints/table_diff.py,sha256=8XTwgOh6QBbNy_hTM1JuHgRjbnie-pGPrphiW-FNLjQ,6058
|
|
422
|
-
sqlmesh-0.211.2.
|
|
423
|
-
sqlmesh-0.211.2.
|
|
424
|
-
sqlmesh-0.211.2.
|
|
425
|
-
sqlmesh-0.211.2.
|
|
426
|
-
sqlmesh-0.211.2.
|
|
422
|
+
sqlmesh-0.211.2.dev2.dist-info/METADATA,sha256=eRMMo1P2DMyeqqYL3g5V9rjB_JN40Tcx0F70pYBKnhU,26773
|
|
423
|
+
sqlmesh-0.211.2.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
424
|
+
sqlmesh-0.211.2.dev2.dist-info/entry_points.txt,sha256=sHAf6tQczIM8xZoduN4qaUjV7QEPVUUW_LCT8EDUMv4,155
|
|
425
|
+
sqlmesh-0.211.2.dev2.dist-info/top_level.txt,sha256=RQ-33FPe2IgL0rgossAfJkCRtqslz9b7wFARqiWLC5Q,24
|
|
426
|
+
sqlmesh-0.211.2.dev2.dist-info/RECORD,,
|
sqlmesh_dbt/cli.py
CHANGED
|
@@ -46,10 +46,19 @@ exclude_option = click.option("--exclude", multiple=True, help="Specify the node
|
|
|
46
46
|
@click.group(invoke_without_command=True)
|
|
47
47
|
@click.option("--profile", help="Which existing profile to load. Overrides output.profile")
|
|
48
48
|
@click.option("-t", "--target", help="Which target to load for the given profile")
|
|
49
|
+
@click.option(
|
|
50
|
+
"-d",
|
|
51
|
+
"--debug/--no-debug",
|
|
52
|
+
default=False,
|
|
53
|
+
help="Display debug logging during dbt execution. Useful for debugging and making bug reports events to help when debugging.",
|
|
54
|
+
)
|
|
49
55
|
@click.pass_context
|
|
50
56
|
@cli_global_error_handler
|
|
51
57
|
def dbt(
|
|
52
|
-
ctx: click.Context,
|
|
58
|
+
ctx: click.Context,
|
|
59
|
+
profile: t.Optional[str] = None,
|
|
60
|
+
target: t.Optional[str] = None,
|
|
61
|
+
debug: bool = False,
|
|
53
62
|
) -> None:
|
|
54
63
|
"""
|
|
55
64
|
An ELT tool for managing your SQL transformations and data models, powered by the SQLMesh engine.
|
|
@@ -61,7 +70,9 @@ def dbt(
|
|
|
61
70
|
|
|
62
71
|
# we have a partially applied function here because subcommands might set extra options like --vars
|
|
63
72
|
# that need to be known before we attempt to load the project
|
|
64
|
-
ctx.obj = functools.partial(
|
|
73
|
+
ctx.obj = functools.partial(
|
|
74
|
+
create, project_dir=Path.cwd(), profile=profile, target=target, debug=debug
|
|
75
|
+
)
|
|
65
76
|
|
|
66
77
|
if not ctx.invoked_subcommand:
|
|
67
78
|
if profile or target:
|
sqlmesh_dbt/operations.py
CHANGED
|
@@ -16,9 +16,10 @@ logger = logging.getLogger(__name__)
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class DbtOperations:
|
|
19
|
-
def __init__(self, sqlmesh_context: Context, dbt_project: Project):
|
|
19
|
+
def __init__(self, sqlmesh_context: Context, dbt_project: Project, debug: bool = False):
|
|
20
20
|
self.context = sqlmesh_context
|
|
21
21
|
self.project = dbt_project
|
|
22
|
+
self.debug = debug
|
|
22
23
|
|
|
23
24
|
def list_(
|
|
24
25
|
self,
|
|
@@ -55,6 +56,10 @@ class DbtOperations:
|
|
|
55
56
|
self, select: t.Optional[t.List[str]] = None, exclude: t.Optional[t.List[str]] = None
|
|
56
57
|
) -> t.Dict[str, Model]:
|
|
57
58
|
if sqlmesh_selector := selectors.to_sqlmesh(select or [], exclude or []):
|
|
59
|
+
if self.debug:
|
|
60
|
+
self.console.print(f"dbt --select: {select}")
|
|
61
|
+
self.console.print(f"dbt --exclude: {exclude}")
|
|
62
|
+
self.console.print(f"sqlmesh equivalent: '{sqlmesh_selector}'")
|
|
58
63
|
model_selector = self.context._new_selector()
|
|
59
64
|
selected_models = {
|
|
60
65
|
fqn: model
|
|
@@ -119,7 +124,7 @@ def create(
|
|
|
119
124
|
# so that DbtOperations can query information from the DBT project files in order to invoke SQLMesh correctly
|
|
120
125
|
dbt_project = dbt_loader._projects[0]
|
|
121
126
|
|
|
122
|
-
return DbtOperations(sqlmesh_context, dbt_project)
|
|
127
|
+
return DbtOperations(sqlmesh_context, dbt_project, debug=debug)
|
|
123
128
|
|
|
124
129
|
|
|
125
130
|
def init_project_if_required(project_dir: Path) -> None:
|
sqlmesh_dbt/selectors.py
CHANGED
|
@@ -37,6 +37,10 @@ def to_sqlmesh(dbt_select: t.Collection[str], dbt_exclude: t.Collection[str]) ->
|
|
|
37
37
|
-> "+main.model_a & ^(raw.src_data)"
|
|
38
38
|
--select "+main.model_a" --select "main.*b+" --exclude "raw.src_data"
|
|
39
39
|
-> "(+main.model_a | main.*b+) & ^(raw.src_data)"
|
|
40
|
+
--select "+main.model_a" --select "main.*b+" --exclude "raw.src_data" --exclude "main.model_c"
|
|
41
|
+
-> "(+main.model_a | main.*b+) & ^(raw.src_data | main.model_c)"
|
|
42
|
+
--select "+main.model_a main.*b+" --exclude "raw.src_data main.model_c"
|
|
43
|
+
-> "(+main.model_a | main.*b+) & ^(raw.src_data | main.model_c)"
|
|
40
44
|
"""
|
|
41
45
|
if not dbt_select and not dbt_exclude:
|
|
42
46
|
return None
|
|
@@ -44,8 +48,13 @@ def to_sqlmesh(dbt_select: t.Collection[str], dbt_exclude: t.Collection[str]) ->
|
|
|
44
48
|
select_expr = " | ".join(_to_sqlmesh(expr) for expr in dbt_select)
|
|
45
49
|
select_expr = _wrap(select_expr) if dbt_exclude and len(dbt_select) > 1 else select_expr
|
|
46
50
|
|
|
47
|
-
exclude_expr = "
|
|
48
|
-
|
|
51
|
+
exclude_expr = ""
|
|
52
|
+
|
|
53
|
+
if dbt_exclude:
|
|
54
|
+
exclude_expr = " | ".join(_to_sqlmesh(expr) for expr in dbt_exclude)
|
|
55
|
+
exclude_expr = _negate(
|
|
56
|
+
_wrap(exclude_expr) if dbt_select and len(dbt_exclude) > 1 else exclude_expr
|
|
57
|
+
)
|
|
49
58
|
|
|
50
59
|
main_expr = " & ".join([expr for expr in [select_expr, exclude_expr] if expr])
|
|
51
60
|
|
|
@@ -56,13 +65,9 @@ def to_sqlmesh(dbt_select: t.Collection[str], dbt_exclude: t.Collection[str]) ->
|
|
|
56
65
|
return main_expr
|
|
57
66
|
|
|
58
67
|
|
|
59
|
-
def _to_sqlmesh(selector_str: str
|
|
68
|
+
def _to_sqlmesh(selector_str: str) -> str:
|
|
60
69
|
unions, intersections = _split_unions_and_intersections(selector_str)
|
|
61
70
|
|
|
62
|
-
if negate:
|
|
63
|
-
unions = [_negate(u) for u in unions]
|
|
64
|
-
intersections = [_negate(i) for i in intersections]
|
|
65
|
-
|
|
66
71
|
union_expr = " | ".join(unions)
|
|
67
72
|
intersection_expr = " & ".join(intersections)
|
|
68
73
|
|
|
@@ -79,6 +84,7 @@ def _split_unions_and_intersections(selector_str: str) -> t.Tuple[t.List[str], t
|
|
|
79
84
|
# break space-separated items like: "my_first_model my_second_model" into a list of selectors to union
|
|
80
85
|
# and comma-separated items like: "my_first_model,my_second_model" into a list of selectors to intersect
|
|
81
86
|
# but, take into account brackets, eg "(my_first_model & my_second_model)" should not be split
|
|
87
|
+
# also take into account both types in the same string, eg "my_first_model my_second_model model_3,model_4,model_5"
|
|
82
88
|
|
|
83
89
|
def _split_by(input: str, delimiter: str) -> t.Iterator[str]:
|
|
84
90
|
buf = ""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|