-
Notifications
You must be signed in to change notification settings - Fork 154
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-638845: ValueError: unsupported format character with version 1.4.0 #327
Comments
recreate jira |
hey @jonashaag , do you mind sharing unit tests with us so that we could investigate and fix. In 1.4.0 we were doing trying to address the double percent escape by doing string interpolation which is not done in versions < 1.4.0 |
Unfortunately I don't have a reproducing examle that I can share |
from the error info I feel this could be related to special naming like percent sign in table/col names. @jonashaag , could you share the exception stack trace so that we can track how the command is generated. |
|
thanks @jonashaag , I have tried multiple test cases but still failed to reproduce, I will keep trying. in the meanwhile, if you happen to know which exact case is failing in your unit tests, please share it with me. thanks! |
hi @sfc-gh-aling , I'm also facing the same issue: for eg: url = URL( def fetch_data(sql_query): q1 = r"""SELECT id as loan, lead_id, sanctioned_date where lead_id not like '%TU%' and you can create your own database and check. This query works fine in snowflake and returns the desired output but while fetching from python, it throws this error. PS: I'm not getting this error if i remove (lead_id not like '%TU%') and I'm using snowflake-sqlalchemy 1.4.43 (most updated version) Thanks |
thanks for sharing me with your test case @aniket-jain9 ! I will dig into it and let you guys know my findings. |
thanks for your patience, here're some updates from my side: I believe the issue is that in some cases (e.g., the pandas sample), the operation to unset the flag From what I have observed with the pandas sample, First, it would send a query to check whether this is a table using the exactly query The sql will be compiled by sqlalchemy first, so that in the Since I have already make a PR for the fix to rely on the compiled status of sql instead of post_exc to set the flag: #355 |
I have another example for this issue: I could pin down a specific version of Take this file and call it import os
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine(
"snowflake://{user}:{password}@{account}/{database}?warehouse={warehouse}&role={role}".format(
user=os.environ["SNOWFLAKE_USER"],
password=os.environ["SNOWFLAKE_PASSWORD"],
account=os.environ["SNOWFLAKE_ACCOUNT"],
database=os.environ["SNOWFLAKE_DATABASE"],
warehouse=os.environ["SNOWFLAKE_WAREHOUSE"],
role=os.environ["SNOWFLAKE_ROLE"],
)
)
print(pd.read_sql("SELECT 1600 % 400 AS a, 1599 % 400 as b;", engine)) And then create two environments with different versions of sqlalchemy: mamba create -n sqlalchemy1423 snowflake-sqlalchemy pandas 'sqlalchemy=1.4.23' -y
mamba create -n sqlalchemy1424 snowflake-sqlalchemy pandas 'sqlalchemy=1.4.24' -y For
For
For Maybe this helps you to track down the origin of this? Not sure if this is ultimately a |
Adding to the post above: for recent versions of Take the Python snippet from above and create the following environments: mamba create -y -n snowflake-sqlalchemy134 snowflake-sqlalchemy=1.3.4 sqlalchemy pandas
mamba create -y -n snowflake-sqlalchemy140 snowflake-sqlalchemy=1.4.0 sqlalchemy pandas
mamba create -y -n snowflake-sqlalchemy141 snowflake-sqlalchemy=1.4.1 sqlalchemy pandas with snowflake-sqlalchemy=1.3.4
with snowflake-sqlalchemy=1.4.0 (yanked)
with snowflake-sqlalchemy=1.4.1 (and more recent versions)
|
@jtilly thanks for reaching out and sharing us with the reproducing scripts. |
hey folks, we have released 1.4.4 including the fix, could you guys take a try on the latest version to see if it fixes the issue for you? you can upgrade by |
1.4.4 fixes the issue for me. Thank you! |
closing the issue as it was fixed in 1.4.4 |
Environment:
Running some unit tests, excerpt from the logs:
Not happening with < 1.4.0.
The text was updated successfully, but these errors were encountered: