-
Notifications
You must be signed in to change notification settings - Fork 361
Description
SQLMesh Version: 0.226.0
Description:
The SQLMesh VSCode extension currently has limited support for environment variables referenced in config.yaml using the {{ env_var('...') }} syntax, particularly for Snowflake connection credentials like private keys and passphrases.
Current Behavior:
When using environment variable references in config.yaml for Snowflake private key authentication:
gateways:
snowflake:
connection:
type: snowflake
account: my_account
user: my_user
private_key_path: "{{ env_var('SNOWFLAKE_KEY_PATH') }}"
private_key_passphrase: "{{ env_var('SNOWFLAKE_KEY_PASSPHRASE') }}"- ✅ Terminal/CLI: Works perfectly with
sqlmesh plan,sqlmesh run, etc. - ❌ VSCode Extension: Fails with connection errors, requiring hardcoded paths instead
Error Message:
Error: Invalid 'snowflake' connection config: Value error, Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters). Details: ASN.1 parsing error: invalid length Verify your config.yaml and environment variables.
Workaround:
Currently, the only reliable solution is to use hardcoded private_key_path values instead of environment variables:
private_key_path: /absolute/path/to/key.p8Expected Behavior:
The VSCode extension should resolve environment variables in config.yaml the same way the CLI does, allowing users to:
- Keep sensitive paths and credentials out of version control
- Use the same configuration across different environments
- Maintain parity between CLI and extension functionality
Additional Context:
According to the documentation, the extension does support environment variables through:[1]
.envfiles in the project root- Opening VSCode from a terminal with vars set
- Shell configuration files
However, the {{ env_var('...') }} syntax in YAML config appears to not be properly resolved by the language server process.
Proposed Solution:
Enhance the VSCode extension's language server to properly resolve {{ env_var('...') }} references in config.yaml with the same precedence as the CLI, possibly by:
- Loading environment variables earlier in the language server initialization
- Improving error messages to indicate when env vars are unavailable
- Adding a command like "SQLMesh: Validate Environment Variables" to debug config issues
Environment:
- SQLMesh version: 0.226.0
- Platform: Ubuntu 22.04.5 LTS