Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1792786: --config-file ... does not work when connection.toml is present #1839

Open
tylerjt-cvna opened this issue Nov 7, 2024 · 2 comments
Assignees
Labels
connections enhancement New feature or request

Comments

@tylerjt-cvna
Copy link

tylerjt-cvna commented Nov 7, 2024

SnowCLI version

3.0.2

Python version

3.12.3

Platform

Windows-10-10.0.19045-SP0

What happened

snow --config-file .\my.config.toml does not work if there is a connections.toml file in the users home directory (I'm on windows so C:\Users<UserName>\.snowflake). This is a problem because the VS Code Snowflake plugin requires the connection.toml file to work. However, our team would like to structure our project directory so that connections are stored in the project rather than a user config file.

Console output

PS C:\Users\User\source\repos\temp> snow --config-file ./prod.config.toml connection list
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| connection_name | parameters                                                                                                                                                                       | is_default |
|-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------|
| prod            | {'account': '<account>', 'user': '<username>', 'database': '<database>', 'schema': '<schema>', 'warehouse': '<warehouse>', 'role': '<role>', 'authenticator': 'externalbrowser'} | False      |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
PS C:\Users\User\source\repos\temp> echo $null >> C:\Users\User\.snowflake\connections.toml
PS C:\Users\User\source\repos\temp> snow --config-file ./prod.config.toml connection list      
Reading connections from C:\Users\User\.snowflake\connections.toml. Entries from config.toml are ignored.
No data

How to reproduce

snow --config-file ./prod.config.toml connection list
echo $null >> C:\Users\<Username>\.snowflake\connections.toml
snow --config-file ./prod.config.toml connection list
@github-actions github-actions bot changed the title --config-file ... does not work when connection.toml is present SNOW-1792786: --config-file ... does not work when connection.toml is present Nov 7, 2024
@sfc-gh-jsikorski sfc-gh-jsikorski added the bug Something isn't working label Nov 8, 2024
@sfc-gh-pjob sfc-gh-pjob added enhancement New feature or request connections and removed bug Something isn't working labels Nov 12, 2024
@sfc-gh-pjob sfc-gh-pjob self-assigned this Nov 12, 2024
@sfc-gh-pjob
Copy link
Contributor

Hello, as you have described, at the moment connections from connections.toml always override connections from config.toml (it doesn't matter if it is a default config or a custom config). The rest of the settings from config.toml should work. I don't consider it as a bug because it's expected behaviour - our configuration management relies on Snowflake's Python Connector which uses connections.toml as a primary source for connections and we do the same.

However I see that it can be a real issue in your case. We have plans to redesign connections configuration management but it will take some time. At the moment, I have only one idea for a workaround but it isn't so nice and simple as I'd like it to be.

IMO you can set SNOWFLAKE_HOME env variable for CLI's shell session to point to any other directory than your directory with connections.toml. Thanks to that, CLI won't find connections.toml. You have to remember that default logs location will change too but you can change the path to logs in config.toml (see logs configuration docs). Different value for SNOWFLAKE_HOME should be probably set only for the shell running CLI to not interfere with other Snowflake's tools/libraries.

I know that this workaround is far away from an elegant solution but I'm afraid it's the only one which I can suggest at the moment. Can you tell me if it can work for you?

I'll post you updated about our plans to change the current behaviour.

@tylerjt-cvna
Copy link
Author

Hi - Thanks for getting back. This workaround appears to be working. I am able to use the Snowflake VS Code plugin and our project-embedded .toml file at the same time. This should be fine for our use case.

I appreciate you looking into this issue and converting it to a feature request. It would be very nice to be able to override the default connection.toml file for use cases like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connections enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants