Closed jacobsieradzki closed 9 months ago
I was using the dialect object incorrectly. This script worked for me:
from sqlalchemy import create_engine, Column, select, text
import snowflake.connector
result = select(text("*")) \
.select_from(text("table_name")) \
.where(Column("foo") == "bar")
snowflake.connector.paramstyle = "qmark"
engine = create_engine("snowflake://")
compiled = result.compile(dialect=engine.dialect)
# SELECT * FROM table_name WHERE foo = ?
params = [param for param in compiled.params.values()]
# ['bar']
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