Skip to content

Add SnowflakeClient#56

Merged
aaronfriedman6 merged 9 commits intomainfrom
snowflake-client
Mar 20, 2026
Merged

Add SnowflakeClient#56
aaronfriedman6 merged 9 commits intomainfrom
snowflake-client

Conversation

@aaronfriedman6
Copy link
Contributor

@aaronfriedman6 aaronfriedman6 commented Mar 17, 2026

Also updated pytest (to silence #52) and GitHub Actions python versions.

See CHANGELOG for additional changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @yossariano -- I updated this again so that the name of the logger would be output. I also think this means that different struct loggers will now act a little more independently, which is good, although I could be wrong


def __init__(self, account, user, private_key=None, password=None):
self.logger = create_log('snowflake_client')
if (password is None) == (private_key is None):
Copy link
Contributor

@fatimarahman fatimarahman Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah I've never seen a boolean like this before, nice thinking!

Comment on lines +80 to +83
3) This method can be used for both read and write queries, but
it's not optimized for writing -- there is no parameter binding
or executemany support, and the return value for write queries
can be unpredictable.
Copy link
Contributor

@fatimarahman fatimarahman Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is annoying of Snowflake -- can you explain why you decided against using the executemany() function provided? Seems like that allows for parameterization (albeit clunkier)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah in the future we may add transaction support more similar to what we do in the Redshift client, and I can see executemany going in there. I held off putting it in here because: a) I didn't want to jam every possible functionality into the same execute_query function, and b) it's actually unclear to me whether we'll need to be writing to Snowflake that much using this client -- it seems like the more "data lake-y" way would be to upload new files to S3 instead.

Ultimately, I wanted a function that could read data and it just so happened to be that you can also execute arbitrary single SQL commands the same way, but the intention wasn't really to support that as a main use case.

If kms_client is not empty, decrypts the variables first.
Does not allow for sub-dictionaries.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any chance we'd use sub-dictionaries in our configs in the future? Or is that frowned upon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against it! I just think the use case for this file is loading config variables as environment variables, and it's unclear what the user would expect in the case of a subdictionary. Do all of the sub-keys get loaded as their own env variables, or does the whole dict get loaded as a JSON string, or? In general, my feeling is I haven't had a use case that required using sub-dictionaries, so there's no use trying to over-engineer this for a hypothetical use case.

fatimarahman
fatimarahman previously approved these changes Mar 19, 2026
Copy link
Contributor

@fatimarahman fatimarahman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just a couple of clarifying questions

@aaronfriedman6
Copy link
Contributor Author

Bypassing because approval was already given and only an extremely minor change was committed afterwards. I've changed the merge rules to prevent approvals from expiring in the future.

@aaronfriedman6 aaronfriedman6 merged commit fe99672 into main Mar 20, 2026
5 checks passed
@aaronfriedman6 aaronfriedman6 deleted the snowflake-client branch March 20, 2026 16:30
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.

2 participants