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

Set default isolation level to AUTOCOMMIT for snowflake #1719

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

sfc-gh-dhuang
Copy link
Contributor

@sfc-gh-dhuang sfc-gh-dhuang commented Jan 11, 2025

Description

This is needed after snowflake-sqlalchemy >= 1.7.2 because of snowflakedb/snowflake-sqlalchemy#555

Other details good to know for developers

Please include any other details of this change useful for TruLens developers.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • New Tests
  • This change includes re-generated golden test results
  • This change requires a documentation update

Important

Set default isolation level to AUTOCOMMIT for Snowflake connections in SQLAlchemyDB to ensure compatibility with snowflake-sqlalchemy >= 1.7.2.

  • Behavior:
    • Set default isolation_level to AUTOCOMMIT for Snowflake connections in _reload_engine() of SQLAlchemyDB.
    • Applies only if snowflake is detected in engine_params['url'].
  • Compatibility:
    • Ensures compatibility with snowflake-sqlalchemy version 1.7.2 and above.

This description was created by Ellipsis for 41cea5b. It will automatically update as commits are pushed.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 11, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 11, 2025
"isolation_level", "AUTOCOMMIT"
)
# Dispose of the temporary engine
temp_engine.dispose()
Copy link
Contributor

Choose a reason for hiding this comment

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

curious how this works. is the isolation level somehow retained after you dispose of the temporary engine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, isolation_level will be set in self.engine_params and this will be used (in the case of snowflake being the DB) when creating the new engine on lines below

For context, I agree this is a bit ugly but I think the overhead of creating and disposing a temp_engine is okay as it's just opening and closing a DB connection.

@sfc-gh-dhuang sfc-gh-dhuang merged commit d13f96a into main Jan 15, 2025
9 of 10 checks passed
@sfc-gh-dhuang sfc-gh-dhuang deleted the daniel/fix-snowflake-sqlalchemy branch January 15, 2025 00:31
@sfc-gh-dhuang sfc-gh-dhuang mentioned this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants