Skip to content

Commit 8648982

Browse files
SNOW-2665953: Make Streamlit Deployment with Versioned Stages as Default in Snow CLI (#2685)
* Make versioned Streamlit deployment the default behavior ## Changes ### CLI Behavior - `snow streamlit deploy` now uses versioned deployment (FROM syntax) by default - Added `--legacy` flag to use old ROOT_LOCATION deployment - `--experimental` flag is now deprecated but still works (shows warning) ### Code Changes - Added `--legacy` flag to streamlit deploy command - Inverted deployment logic: `if experimental` → `if not legacy` - Renamed `_deploy_experimental()` → `_deploy_versioned()` - Removed `ENABLE_STREAMLIT_VERSIONED_STAGE` feature flag - Updated `_is_spcs_runtime_v2_mode()` to not require experimental flag - SPCS runtime v2 (compute pools) only available in versioned mode ### Test Updates - Added `--legacy` flag to 12 unit tests expecting ROOT_LOCATION behavior - Removed `--experimental` flag from tests now using default behavior - Removed `with_feature_flags` wrapper and parametrization - Updated integration tests to reflect new default ## Breaking Change The default deployment mode changes from ROOT_LOCATION to versioned deployment. Users who want the old behavior must use `--legacy` flag. * Update --legacy flag help text: deployment → stages * Refactor: Extract legacy deployment logic into _deploy_legacy() method For consistency with _deploy_versioned(), extracted the else block's deployment logic into a dedicated _deploy_legacy() method. This improves code organization and makes the deploy() method cleaner. * Use positive condition for legacy flag check Changed from 'if not legacy' to 'if legacy' for better readability. The positive condition directly maps to the flag name and avoids mental negation. * Fix lint: Break long lines to comply with 88 char limit - Split long comment in _deploy_legacy() method - Break deprecation warning string across multiple lines - Format long test invocation call - Fix typo: elswhere → elsewhere * Fix black formatting * Add validation to prevent SPCS runtime v2 usage with --legacy flag * Add documentation for deprecated --experimental flag and parameter naming * Fix test_artifacts.py tests to use --legacy flag for artifact tests * Fix integration tests for versioned Streamlit deployment Update test_streamlit_flow and test_streamlit_deploy_prune_flag to work with versioned Streamlit deployment (now the default behavior). Changes: - test_streamlit_flow: Update stage paths from legacy app_1_stage to versioned snow://streamlit/{DB}.{SCHEMA}.app_1/versions/live/ - test_streamlit_deploy_prune_flag: Rewrite to use managed versioned stages instead of user-created stages Files are now uploaded to managed stages at versions/live/ path instead of user-specified ROOT_LOCATION stages. * Fix unit tests for versioned Streamlit deployment - Add mock for describe() method to return versioned stage path - Update test_deploy to use legacy=True for testing old behavior - Replace experimental parameter with legacy parameter in SPCS runtime v2 tests - Fix test_deploy_with_spcs_runtime_v2_and_legacy_flag_raises_error invalid parameters Changes reflect that versioned deployment is now the default, and the experimental flag has been replaced with a legacy flag to opt into old behavior. * Update help message snapshots for streamlit deploy - Add --legacy flag to streamlit deploy help text - Remove oauth-token-request-url parameter (deprecated) These changes reflect the new default versioned deployment behavior. * Fix help message snapshots - restore oauth-token-request-url for all commands except streamlit The previous commit incorrectly removed oauth-token-request-url from ALL commands. This parameter should only be excluded from streamlit.deploy command, but remain in all other commands' help text. * Restore oauth-token-request-url to streamlit.deploy help message This parameter is a standard connection option that applies to all commands including streamlit. Cannot be removed from just streamlit.deploy. * Fix test_streamlit_deploy_prune_flag: add --overwrite flag for streamlit stage Snowflake requires overwrite=true when uploading to streamlit versioned stages. The test was failing because stage copy needs --overwrite flag when uploading to snow://streamlit/ managed stages. * Fix test_streamlit_deploy_prune_flag: test with --legacy flag Versioned stages are managed by Snowflake's FBE and have different file lifecycle behavior. The prune flag functionality is primarily for legacy ROOT_LOCATION stages where the CLI has full control over file management. Changed the test to use --legacy flag to properly test the prune functionality on legacy stages instead of versioned stages. * Address PR review comments: simplify help text, use CliError, and reduce comment bloat * Fix test_streamlit_deploy_prune_flag database context mismatch * Fix unit test: update exception type to CliError and mock bundle to avoid file errors * Update help message snapshot for --legacy flag text change * Add gitattributes to ensure snapshot files use consistent encoding across platforms * Fix Unicode smart quotes in snapshot file - replace with ASCII apostrophes * Address PR review comments: add RELEASE-NOTES entry, move test imports to top, add deployment style change warnings * Fix integration test: use fully qualified stage name to match deployment database context * Fix integration test: explicitly set database and schema for streamlit deploy commands * Fix integration test: remove explicit database/schema flags, rely on test_database fixture env var * Fix integration test * Update RELEASE-NOTES to reflect deprecations and new additions for `snow streamlit deploy` and `snow dbt` commands, including versioned deployment and legacy support. Enhance clarity by formatting entries as bullet points.
1 parent 465a2a3 commit 8648982

File tree

13 files changed

+402
-181
lines changed

13 files changed

+402
-181
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ensure snapshot files are treated as text with LF line endings and UTF-8 encoding
2+
*.ambr text eol=lf

RELEASE-NOTES.md

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818

1919
## Deprecations
2020

21+
* `snow streamlit deploy --experimental` flag is deprecated. Versioned deployment is now the default behavior.
22+
2123
## New additions
2224

23-
## Fixes and improvements
25+
* `snow streamlit deploy` now uses versioned stages by default (modern FROM syntax with automatic version management)
26+
* Added `snow streamlit deploy --legacy` flag to use the legacy ROOT_LOCATION deployment for backward compatibility
2427

28+
## Fixes and improvements
2529

2630
# v3.13.1
2731
## Backward incompatibility
@@ -55,33 +59,34 @@
5559
* Grant privileges defined in `snowflake.yml` after deploying Streamlit
5660
* Relaxed dbt profiles.yml validation rules; added extra validation for role specified in profiles.yml
5761

58-
5962
# v3.12.0
6063

6164
## Deprecations
6265

6366
## New additions
67+
6468
* The `!edit` command for external editors was added to REPL
6569
* Added `--partial` flag to `snow logs` command for partial, case-insensitive object name matching
6670

6771
## Fixes and improvements
72+
6873
* Fixed crashes with older x86_64 Intel CPUs
6974
* Improved parsing `!source` with trailing comments
7075
* `!` commands no longer require trailing `;` for evaluation
7176
* Bumped to `typer=0.17.3`. Improved displaying help messages.
7277
* Fixed using `ctx.var` in `snow sql` with Jinja templating.
7378
* Fixed issues when pasting content with trailing new lines.
74-
* Improved output handling with streaming
79+
* Improved output handling with streaming
7580
* Bumped `snowflake-connector-python` to 3.17.3
7681
* Fixed `snow snowpark deploy` failing on duplicated packages
7782
* Fixed `snow spcs logs` `IndexOutOfRange` error
7883

79-
8084
# v3.11.0
8185

8286
## Deprecations
8387

8488
## New additions
89+
8590
* Add `snow connection remove` command
8691
* Added support for `runtime_environment_version` field in notebook entity configuration, allowing specification of runtime environment version for containerized notebooks.
8792
* Added `snow auth oidc` command group for managing workload identity federation authentication:
@@ -90,24 +95,25 @@
9095

9196
## Fixes and improvements
9297

93-
9498
# v3.10.1
9599

96100
## Deprecations
97101

98102
## New additions
99103

100104
## Fixes and improvements
105+
101106
* Fixed DBT deploy command to properly handle fully qualified names
102107
* Fixed DBT deploy command to properly handle local directories with dots in names
103108

104-
105109
# v3.10.0
106110

107111
## Deprecations
112+
108113
* Snowpark processor in Native Apps.
109114

110115
## New additions
116+
111117
* Add support for passing OAuth token via `--token` flag.
112118
* Added feature to allow suppressing the new version warning message in the Snowflake CLI, configurable via a configuration file or environment variable.
113119
* Add support for `--format=CSV`.
@@ -120,52 +126,53 @@
120126
* DBT commands: `deploy`, `execute` and `list` are now available in preview.
121127

122128
## Fixes and improvements
129+
123130
* Fixed failing snow sql command when snowflake.yml is invalid and query has no templating.
124131
* Fix JSON serialization for `Decimal`, `time` and `binary`.
125132
* Added `--format=JSON_EXT` option to return JSON objects as proper JSON structures rather than strings.
126133
* Refactored Streamlit app deployment (using `FROM <stage>` syntax); removed deprecated Streamlit features
127134

128-
129135
# v3.9.1
130136

131137
## Deprecations
132138

133139
## New additions
140+
134141
* Added `--private-link` flag to `snow spcs image-registry login` command to login using private link URLs.
135142

136143
## Fixes and improvements
137144

138-
139145
# v3.9.0
140146

141147
## Deprecations
142148

143149
## New additions
150+
144151
* Added `--encryption` flag to `snow stage create` command defining the type of encryption for all files on the stage.
145152

146153
## Fixes and improvements
147-
* Fix `use` commands error if current database is not set.
148154

155+
* Fix `use` commands error if current database is not set.
149156

150157
# v3.8.3
151158

152159
## Deprecations
153160

154161
## New additions
162+
155163
* Added `--private-link` flag to `snow spcs image-registry url` command for retrieving private link URLs.
156164

157165
## Fixes and improvements
158166

159-
160167
# v3.8.2
161168

162169
## Deprecations
163170

164171
## New additions
165172

166173
## Fixes and improvements
167-
* Fix `enable_release_channels` property in application package definition to default to `None` instead of `False`.
168174

175+
* Fix `enable_release_channels` property in application package definition to default to `None` instead of `False`.
169176

170177
# v3.8.1
171178

@@ -174,15 +181,16 @@
174181
## New additions
175182

176183
## Fixes and improvements
184+
177185
* Upgrade message is printed to stderr.
178186
* Fixed `snowflake.core` import issue on newer Python versions
179187

180-
181188
# v3.8.0
182189

183190
## Deprecations
184191

185192
## New additions
193+
186194
* Added support for OAuth tokens.
187195
* Cleaning up the output directory after coping files to the stage for Streamlit, Notebook, SPCS Service and project.
188196
* Added interactive mode for `snow sql`.
@@ -192,21 +200,21 @@
192200
* Added `--single-transaction` flag to `snow sql`. Wraps BEGIN/COMMIT around statements to execute them as a single transaction, ensuring all commands complete successfully or no change is applied.
193201

194202
## Fixes and improvements
203+
195204
* Fix for deploying Snowpark project using `!=` operator in `requirements.txt`.
196205
* Fix escaping identifiers for `use` commands.
197206
* Move `enable_release_channels` from global feature flag to project level.
198207
* Fixed `snow spcs service metrics` command to accept fully qualified service names.
199208

200-
201209
# v3.7.2
202210

203211
## Deprecations
204212

205213
## New additions
206214

207215
## Fixes and improvements
208-
* Fix error appearing on help messages after click BCR update.
209216

217+
* Fix error appearing on help messages after click BCR update.
210218

211219
# v3.7.1
212220

@@ -215,32 +223,35 @@
215223
## New additions
216224

217225
## Fixes and improvements
226+
218227
* Fix certificate connection issues.
219228
* Fix `snow spcs image-registry login` slow query problem.
220229

221-
222230
# v3.7.0
223231

224232
## Deprecations
225233

226234
## New additions
235+
227236
* Added `--prune` flag to `deploy` commands, which removes files that exist in the stage,
228237
but not in the local filesystem.
229238
* Added `snow logs` command for retrieving and streaming logs from the server.
230239
* Added `snow helper check-snowsql-env-vars` which reports environment variables from SnowSQL with replacements in CLI.
231240

232241
## Fixes and improvements
233-
* Updated MacOS postinstall script to update PATH if snow not exist.
234242

243+
* Updated MacOS postinstall script to update PATH if snow not exist.
235244

236245
# v3.6.0
237246

238247
## Deprecations
239248

240249
## New additions
250+
241251
* Added support for `!source` command in SQL. This command allows to execute SQL from a local file.
242252

243253
## Fixes and improvements
254+
244255
* Fix for incompatible options in `snow spcs compute-pool` commands didn't raise error.
245256
* Change binary builds to embed whole Python environment.
246257
* Fixed recursive copying to stage for unbalanced directory trees.
@@ -252,6 +263,7 @@
252263
## Deprecations
253264

254265
## New additions
266+
255267
* Extended snowflake.yml support for new entities:
256268
* SPCS compute pool
257269
* SPCS service
@@ -262,9 +274,11 @@
262274
* Added support for creating native applications with manifest version 2.
263275

264276
## Fixes and improvements
277+
265278
* Fix handling of date types in `snow sql` command when using JSON for output format
266279

267280
# v3.4.1
281+
268282
## Backward incompatibility
269283

270284
## Deprecations
@@ -290,10 +304,10 @@
290304
* Added notebooks to `snow object` commands.
291305

292306
## Fixes and improvements
307+
293308
* Fixed MFA caching issue in binaries.
294309
* Fixed auto-completion issue in binaries.
295310

296-
297311
# v3.3.0
298312

299313
## Backward incompatibility
@@ -446,7 +460,7 @@
446460
* `snow snowpark build` creates a .zip file for each specified artifact that is a directory. Non-Anaconda
447461
dependencies are packaged once as `dependencies.zip`.
448462
* `snow snowpark deploy` uploads all artifacts created during build step. Dependencies zip is upload once to
449-
every Snowpark stage specified in project definition.
463+
every Snowpark stage specified in project definition.
450464
* The changes are compatible with V1 projects definition though the result state (file layout) is different.
451465
* `snow snowpark package` commands no longer fallback to Anaconda Channel metadata when fetching available packages info fails.
452466
* Added `snow streamlit execute app-name` command to run Streamlit apps in a Snowflake environment in headless mode.
@@ -540,7 +554,7 @@
540554
## Deprecations
541555

542556
* `snow snowpark init` and `snow streamlit init` are marked as deprecated. The commands are still functional,
543-
but should be replaced with `snow init`
557+
but should be replaced with `snow init`
544558

545559
## New additions
546560

@@ -594,9 +608,9 @@ but should be replaced with `snow init`
594608
* Overrides `env` variables values when used in templating.
595609
* Can be referenced in templating through `ctx.env.<key_name>`.
596610
* Templating will read env vars in this order of priority (highest priority to lowest priority):
597-
* vars from `--env` command line argument.
598-
* vars from shell environment variables.
599-
* vars from `env` section of project definition file.
611+
- vars from `--env` command line argument.
612+
- vars from shell environment variables.
613+
- vars from `env` section of project definition file.
600614

601615
## Fixes and improvements
602616

@@ -666,19 +680,19 @@ but should be replaced with `snow init`
666680
* `snow spcs image-repository` for image repositories
667681
* `snow spcs service` for services
668682
* `snow sql` works now with `snowflake.yml` file. The variables defined in the new `env` section
669-
of `snowflake.yml` will be used to expand templates.
683+
of `snowflake.yml` will be used to expand templates.
670684
* `snow sql` support executing multiple files. Users can use `-f/--file` flag more than once to execute queries
671-
from many files.
685+
from many files.
672686
* `snow git execute` and `snow stage execute` support passing input variables for SQL execution.
673687
* Added `snow cortex` commands:
674688
* `complete` - Given a prompt, the command generates a response using your choice of language model.
675-
In the simplest use case, the prompt is a single string. You may also provide a JSON file with conversation history including multiple prompts and responses for interactive chat-style usage.
689+
In the simplest use case, the prompt is a single string. You may also provide a JSON file with conversation history including multiple prompts and responses for interactive chat-style usage.
676690
* `extract-answer` - Extracts an answer to a given question from a text document.
677-
The document may be a plain-English document or a string representation of a semi-structured (JSON) data object.
691+
The document may be a plain-English document or a string representation of a semi-structured (JSON) data object.
678692
* `sentiment` - Returns sentiment as a score between -1 to 1 (with -1 being the most negative and 1 the most positive, with values around 0 neutral) for the given English-language input text.
679693
* `summarize` - Summarizes the given English-language input text.
680694
* `translate` - Translates text from the indicated or detected source language to a target language.
681-
* `search` - for integration with Cortex Search Service
695+
* `search` - for integration with Cortex Search Service
682696
* When invoked without command help is displayed by default with list of available commands.
683697
* Add tab-completion for `snow` command.
684698

@@ -747,7 +761,7 @@ but should be replaced with `snow init`
747761
* `--check-anaconda-for-pypi-depts` is deprecated and using it will cause warning, the functionality is replaced by `--ignore-anaconda`
748762
* `--package-native-libraries` is deprecated and using it will cause warning, the functionality is replaced by `--allow-shared-libraries`
749763
* `snow object stage` commands are deprecated and using them will cause a warning.
750-
Functionality is replaced by `snow stage` commands.
764+
Functionality is replaced by `snow stage` commands.
751765

752766
## New additions
753767

@@ -846,6 +860,7 @@ but should be replaced with `snow init`
846860
The `SNOWFLAKE_CONNECTION_<NAME>_<KEY>` variable takes precedence before the generic flag. For example if
847861
`SNOWFLAKE_PASSWORD` and `SNOWFLAKE_CONNECTIONS_FOO_PASSWORD` are present and user tries to use connection
848862
"foo" then the later variable will be used.
863+
849864
* Testing connection using `snow connection test` validates also access to database, schema, role and warehouse
850865
specified in the connection details.
851866
* Added `snow connection set-default` command for changing default connection.
@@ -872,10 +887,12 @@ but should be replaced with `snow init`
872887
* `snow connection test` now outputs all connection details (except for the password), along with connection status
873888
* `snow sql` requires explicit `-i` flag to read input from stdin: `cat my.sql | snow sql -i`
874889
* Switched to Python Connector default connection <https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect#setting-a-default-connection>
890+
875891
* Default connection name changed from `dev` to `default`
876892
* Environment variable for default connection name changed from `SNOWFLAKE_OPTIONS_DEFAULT_CONNECTION` to `SNOWFLAKE_DEFAULT_CONNECTION_NAME`
877893

878894
* Snowpark changes
895+
879896
* Removed `procedure` and `function` subgroups.
880897
* Removed `snow snowpark function package` and `snow snowpark procedure package` in favour of `snow snowpark build`.
881898
* Removed `snow snowpark function create` and `snow snowpark function update`. Functions can be deployed using `snow snowpark deploy`.
@@ -887,6 +904,7 @@ but should be replaced with `snow init`
887904
* Coverage commands were removed. To measure coverage of your procedures or functions use coverage locally.
888905

889906
* Snowpark Containers services commands
907+
890908
* `cp` alias for `compute-pool` commands was removed.
891909
* `services` commands were renamed to `service`
892910
* `registry` commands were renamed to `image-registry`

0 commit comments

Comments
 (0)