SNOW-3445886: add environment variable and secret support for DCM projects#3148
Open
sfc-gh-gjachimko wants to merge 4 commits into
Conversation
…jects `snow dcm deploy/plan/preview/raw-analyze` now collect declared `templating.env_vars`/`templating.env_secrets` from the shell environment and forward them via `ENVIRONMENT (?)`, matching the server-side support already shipped in GlobalServices. `raw-analyze` previously had no support for this at all. - Fix DCMTemplating.from_dict(): manifest env_vars/env_secrets are a list of single-key mapping objects, not flat strings. - Add env.py: collect_env_vars() reads declared names from os.environ, silently omitting names that aren't exported. - Add BaseSqlExecutor.execute_query_with_params(), forcing qmark paramstyle so a literal `?` binds server-side instead of being left untouched by the connector's default pyformat paramstyle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Verifies USING CONFIGURATION/variables and ENVIRONMENT compose correctly in the same query (ENVIRONMENT is stacked after USING, before FROM) instead of one clobbering the other -- no existing test combined both in a single call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
snow dcm deploy/plan/preview/raw-analyzenow collect declaredtemplating.env_vars/templating.env_secretsfrom the shell environment and forward them viaENVIRONMENT (?), matching the server-side support already shipped in GlobalServices.raw-analyzepreviously had no support for this at all.DCMTemplating.from_dict(): manifestenv_vars/env_secretsare a list of single-key mapping objects (e.g.- BUILD_NUMBER:), not flat strings — the old parsing silently produced wrong declared-name sets.BaseSqlExecutor.execute_query_with_params(), forcing qmark paramstyle so a literal?binds server-side instead of being left untouched by the connector's default pyformat paramstyle.Test plan
tests/dcm/test_env.py,tests/dcm/test_models.py,tests/dcm/test_manager.py,tests/dcm/test_commands.py,tests/api/test_sql_execution.py) — 331 passing intests/dcm/+tests/api/test_sql_execution.py.raw-analyze/planwith real env vars/secrets, env-var-driven Jinja control flow, and the manifest-declared-name filtering, all confirmed end-to-end.Pre-review checklist
RELEASE-NOTES.md.deploy/plan/preview/analyzebehavior).🤖 Generated with Claude Code