SNOW-3995071: Expand tilde in token_file_path - #3044
Open
cristiangirlea wants to merge 1 commit into
Open
cristiangirlea wants to merge 1 commit into
cristiangirlea wants to merge 1 commit into
Conversation
cristiangirlea
force-pushed
the
SNOW-3995071-expand-tilde-token-file-path
branch
from
September 30, 2026 16:41
5c53e38 to
f1b1e4e
Compare
`token_file_path` was passed straight to `open()`, so a path such as `~/.snowflake/pat.token` (e.g. from connections.toml) failed with FileNotFoundError. Reuse the existing `expand_tilde` helper, as already done for `private_key_file`. The async connection shares the same config path, so it is covered too. Fixes snowflakedb#3006
cristiangirlea
force-pushed
the
SNOW-3995071-expand-tilde-token-file-path
branch
from
October 1, 2026 12:00
f1b1e4e to
c4557d8
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
This branch has not been deployed
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.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-3995071: PAT to support path expansion #3006
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
token_file_pathwas passed straight toopen(), so a path using the home shorthand, such as~/.snowflake/pat.tokeninconnections.toml, failed withFileNotFoundError. This PR reuses the existingutil_text.expand_tildehelper, which SNOW-3020359 expand tilde to key file path in connection #2759 introduced forprivate_key_file, so both connection parameters behave the same way. Non-string values and environments where the home directory can't be resolved pass through unchanged, as withprivate_key_file.The async
SnowflakeConnectioninherits the same__configpath, so it is covered too.Test:
test_pat_token_file_path_expands_tildepointsHOME/USERPROFILEat a temp directory, connects withPROGRAMMATIC_ACCESS_TOKENandtoken_file_path="~/.snowflake/pat.token", and asserts that the token read from the file is the one sent in the login request. Without the fix it fails with the error reported in the issue:FileNotFoundError: [Errno 2] No such file or directory: '~/.snowflake/pat.token'.Also ran
test_connection.py,test_auth_keypair.py,test_text_util.pyandaio/test_connection_async_unit.pylocally (152 passed), and pre-commit passes on the changed files.