-
Notifications
You must be signed in to change notification settings - Fork 165
Description
What is the current behavior?
When accessing dialect.server_version_info on a Snowflake SQLAlchemy dialect, it returns None or raises an AttributeError. This attribute is commonly available in other SQLAlchemy dialects (like PostgreSQL) and is used to check database version information.
Example code that fails:
engine = create_engine("snowflake://user:password@account_id/database")
# This line fails or returns None
version_info = engine.dialect.server_version_info
What is the desired behavior?
The dialect.server_version_info attribute should return the Snowflake version information, similar to how other SQLAlchemy dialects implement this attribute. This would allow for consistent version checking across different database backends.
Ideally, it would return a tuple of version components (e.g., (7, 11, 0)) that can be used for version comparison operations.
How would this improve snowflake-connector-python
?
This improvement would:
Enhance compatibility with code that works with multiple database backends
Allow applications to perform version-specific logic without custom code for Snowflake
Make it easier to implement feature detection based on Snowflake version
Align the Snowflake dialect more closely with SQLAlchemy conventions
References, Other Background
SQLAlchemy PostgreSQL dialect implements this: https://docs.sqlalchemy.org/en/20/core/internals.html#sqlalchemy.engine.Dialect.server_version_info
The information could be populated from CURRENT_VERSION() Snowflake function
This would make Snowflake dialect more consistent with other SQLAlchemy dialects