-
Notifications
You must be signed in to change notification settings - Fork 151
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
SNOW-740870: snowpark-python and snowflake-sqlalchemy packages are not compatible #383
Comments
The problem seems to stem from the The I was able to work around the issue by adding constructor arguments to enforce usage of I explained my findings to the SF support person assigned to my ticket and they said they are investigating the issue but we have a workaround for now. This is the patch to the code that works around the issue: diff --git a/snowtest_original.py b/snowtest_fixed.py
index 250108f..c7ebb4f 100644
--- a/snowtest_original.py
+++ b/snowtest_fixed.py
@@ -46,13 +46,21 @@ def init_db_engine(**create_engine_kwargs) -> sa.engine.Engine:
"", # fragment
)
)
- return sa.create_engine(sqlalchemy_url, **create_engine_kwargs)
+
+ create_engine_kwargs["connect_args"] = create_engine_kwargs.get("connect_args", {})
+ if "paramstyle" in create_engine_kwargs["connect_args"]:
+ raise RuntimeError(
+ "paramstyle must be set to pyformat, other param styles currently have SF connector bugs"
+ )
+ create_engine_kwargs["connect_args"]["paramstyle"] = "pyformat"
+ return sa.create_engine(sqlalchemy_url, paramstyle="pyformat", **create_engine_kwargs)
def get_snowpark_session():
"""Get a SnowPark client session instance."""
- sf_env = get_snowflake_env_vars()
- return Session.builder.configs(sf_env).create()
+ connection_params = get_snowflake_env_vars()
+ connection_params["paramstyle"] = "pyformat"
+ return Session.builder.configs(connection_params).create()
db_engine = init_db_engine() |
per this comment in snowpark-python, it is fixed with snowpark-python PR snowflakedb/snowpark-python#692 thank you very much for all the time working with Snowflake, the detailed description and reproduction - helped us to find and eliminate an obscure bug in Snowpark Python! |
(also created an issue in the
snowpark-python
github: snowflakedb/snowpark-python#673)pip freeze
)?snowflake packages
full outuput
Run the following python script that uses snowflake SQLAlchemy and SnowPark.
(note environment variables used for
snowsql
are used to configure the Snowflake connection)What did you expect to see?
Program to run and exit without an error.
Can you set logging to DEBUG and collect the logs?
The text was updated successfully, but these errors were encountered: