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

Make Snowpark dependency truly optional for SnowflakeConnection #7919

Merged
merged 1 commit into from Jan 11, 2024

Conversation

vdonato
Copy link
Collaborator

@vdonato vdonato commented Jan 9, 2024

There's currently a bug in SnowflakeConnection where we attempt to import snowflake.snowpark on
connect, which blows up when snowflake-snowpark-python, which should be optional for use of this
connection, isn't installed. This PR fixes this by moving some imports and handling ModuleNotFoundErrors
in the running_in_sis helper function.

@vdonato vdonato force-pushed the vdonato/snowpark-import-fix branch from 4f7e565 to c8c2557 Compare January 9, 2024 02:18
@@ -48,6 +47,14 @@ def test_not_running_in_sis(self):
def test_running_in_sis(self):
assert running_in_sis()

@pytest.mark.require_snowflake
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Having to do this is mildly unfortunate, but we can't mock snowflake.* without having snowflake-connector-python installed. In reality, having either the snowflake or snowpark libraries not installed will result in a ModuleNotFoundError being thrown.

@vdonato vdonato marked this pull request as ready for review January 10, 2024 07:00
@vdonato vdonato merged commit 7d60fbf into develop Jan 11, 2024
44 checks passed
@vdonato vdonato deleted the vdonato/snowpark-import-fix branch January 11, 2024 01:23
zyxue pushed a commit to zyxue/streamlit that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants