You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use SQLAlchemy just to generate a SQL string, not run it. However, whenever trying to use snowdialect I see a number of errors:
fromsqlalchemyimportColumn, select, textfromsnowflake.sqlalchemyimportsnowdialectprint("---- statement\n")
result=select(text("*")) \
.select_from(text("table_name")) \
.where(Column("foo") =="bar")
compiled=result.compile()
print(compiled) # SELECT * FROM table_name WHERE foo = :foo_1print(compiled.params) # {'foo_1': 'bar'}# This fails!print(result.compile(dialect=snowdialect.dialect)) # AttributeError: type object 'SnowflakeDialect' has no attribute 'positional'
I also tried to be a bit hacky to see if I could resolve, but it seems like many of the properties required for compile function are not present:
d=snowdialect.dialectd.positional=Falsed.paramstyle='qmark'd.label_length=Noneprint(result.compile(dialect=d))
# AttributeError: type object 'SnowflakeDialect' has no attribute 'positional'# AttributeError: type object 'SnowflakeDialect' has no attribute 'paramstyle'# AttributeError: type object 'SnowflakeDialect' has no attribute 'label_length'# AttributeError: type object 'SnowflakeDialect' has no attribute 'identifier_preparer'# and so on ...
5. What did you expect to see?
I expected the error not to fail and output a SQL string with qmark bind variables.:
github-actionsbot
changed the title
compile with snowdialect does not work (AttributeError: type object 'SnowflakeDialect' has no attribute 'positional')
SNOW-1050043: compile with snowdialect does not work (AttributeError: type object 'SnowflakeDialect' has no attribute 'positional')
Feb 8, 2024
1. What version of Python are you using?
Tried with both 3.9 and 3.11
2. What operating system and processor architecture are you using?
3. What are the component versions in the environment (
pip freeze
)?4. What did you do?
I want to use SQLAlchemy just to generate a SQL string, not run it. However, whenever trying to use
snowdialect
I see a number of errors:I also tried to be a bit hacky to see if I could resolve, but it seems like many of the properties required for compile function are not present:
5. What did you expect to see?
I expected the error not to fail and output a SQL string with qmark bind variables.:
6. Can you set logging to DEBUG and collect the logs?
No logs output
The text was updated successfully, but these errors were encountered: