Skip to content

Commit 3f52b9a

Browse files
feat: [NOSNOW] dcm deploy: add skip plan option
1 parent e0836d1 commit 3f52b9a

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/snowflake/cli/_plugins/dcm/commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ def deploy(
112112
variables: Optional[List[str]] = variables_flag,
113113
configuration: Optional[str] = configuration_flag,
114114
alias: Optional[str] = alias_option,
115+
skip_plan: bool = typer.Option(
116+
False,
117+
"--skip-plan",
118+
help="Skips planning step",
119+
),
115120
**options,
116121
):
117122
"""
@@ -122,13 +127,16 @@ def deploy(
122127

123128
with cli_console.spinner() as spinner:
124129
spinner.add_task(description=f"Deploying dcm project {identifier}", total=None)
130+
if skip_plan:
131+
cli_console.warning("Skipping planning step")
125132
result = manager.execute(
126133
project_identifier=identifier,
127134
configuration=configuration,
128135
from_stage=effective_stage,
129136
variables=variables,
130137
alias=alias,
131138
output_path=None,
139+
skip_plan=skip_plan,
132140
)
133141
return QueryJsonValueResult(result)
134142

src/snowflake/cli/_plugins/dcm/manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def execute(
8686
dry_run: bool = False,
8787
alias: str | None = None,
8888
output_path: str | None = None,
89+
skip_plan: bool = False,
8990
):
9091
with self._collect_output(project_identifier, output_path) if (
9192
output_path and dry_run
@@ -109,6 +110,8 @@ def execute(
109110
query += f" FROM {stage_path.absolute_path()}"
110111
if output_stage is not None:
111112
query += f" OUTPUT_PATH {output_stage}"
113+
if skip_plan:
114+
query += f" SKIP PLAN"
112115
result = self.execute_query(query=query)
113116

114117
return result

tests/__snapshots__/test_help_messages.ambr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7356,6 +7356,7 @@
73567356
| --configuration TEXT Configuration of the DCM Project to use. If |
73577357
| not specified default configuration is used. |
73587358
| --alias TEXT Alias for the deployment. |
7359+
| --skip-plan Skips planning step |
73597360
| --help -h Show this message and exit. |
73607361
+------------------------------------------------------------------------------+
73617362
+- Connection configuration ---------------------------------------------------+

tests/dcm/test_commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def test_deploy_project(
9292
variables=None,
9393
alias=None,
9494
output_path=None,
95+
skip_plan=False,
9596
)
9697

9798
@mock.patch(DCMProjectManager)
@@ -112,6 +113,7 @@ def test_deploy_project_with_from_stage(
112113
variables=None,
113114
alias=None,
114115
output_path=None,
116+
skip_plan=False,
115117
)
116118

117119
@mock.patch(DCMProjectManager)
@@ -134,6 +136,7 @@ def test_deploy_project_with_variables(
134136
variables=["key=value"],
135137
alias=None,
136138
output_path=None,
139+
skip_plan=False,
137140
)
138141

139142
@mock.patch(DCMProjectManager)
@@ -164,6 +167,7 @@ def test_deploy_project_with_configuration(
164167
variables=None,
165168
alias=None,
166169
output_path=None,
170+
skip_plan=False,
167171
)
168172

169173
@mock.patch(DCMProjectManager)
@@ -186,6 +190,7 @@ def test_deploy_project_with_alias(
186190
variables=None,
187191
alias="my_alias",
188192
output_path=None,
193+
skip_plan=False,
189194
)
190195

191196
@mock.patch("snowflake.cli._plugins.dcm.manager.StageManager.create")

0 commit comments

Comments
 (0)