Skip to content

SNOW-3445886: add environment variable and secret support for DCM projects#3148

Open
sfc-gh-gjachimko wants to merge 4 commits into
snowflakedb:mainfrom
sfc-gh-gjachimko:SNOW-3445886_add_env_variable_support_for_dcm_projects
Open

SNOW-3445886: add environment variable and secret support for DCM projects#3148
sfc-gh-gjachimko wants to merge 4 commits into
snowflakedb:mainfrom
sfc-gh-gjachimko:SNOW-3445886_add_env_variable_support_for_dcm_projects

Conversation

@sfc-gh-gjachimko

@sfc-gh-gjachimko sfc-gh-gjachimko commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • 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.
  • Fixes DCMTemplating.from_dict(): manifest env_vars/env_secrets are a list of single-key mapping objects (e.g. - BUILD_NUMBER:), not flat strings — the old parsing silently produced wrong declared-name sets.
  • Adds 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

  • Unit tests added/updated (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 in tests/dcm/ + tests/api/test_sql_execution.py.
  • Hands-on verified against a live GS instance via a locally-built CLI image: raw-analyze/plan with real env vars/secrets, env-var-driven Jinja control flow, and the manifest-declared-name filtering, all confirmed end-to-end.
  • Manual macOS/Windows testing (macOs)
  • Maintainer design sign-off

Pre-review checklist

  • If my changes add or modify user-facing interface (commands, flags, output formats), I consulted maintainers and got sign-off beforehand
  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code — covered instead by hands-on verification against a live GS instance (see test plan).
  • Manually tested on macOS
  • Manually tested on Windows
  • I've confirmed my changes are up-to-date with the target branch.
  • I've described my changes in RELEASE-NOTES.md.
  • I've updated documentation if behavior changed — no doc changes needed (no new flags; env var collection is automatic based on manifest declarations, applicable for deploy/plan/preview/analyze behavior).

🤖 Generated with Claude Code

sfc-gh-gjachimko and others added 4 commits July 21, 2026 19:22
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant