Create compiled query without parameters #4480
-
In ibis 3.1.0, I am wondering how I generate the query string without parameter placeholders. conn = ibis.postgres.connect(....)
table = conn.get_table(table_name)
q = table.limit(100)
c = q.compile()
str() returns SELECT t0.*
FROM <table_name AS t0
LIMIT %(param_1)s The best I could find right now is to add another compile call this time to the sqlalchemy select object like this c.compile(compile_kwargs={"literal_binds": True}) Is that the easiest way or am I overlooking a method? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@saschahofmann That is correct, the old "double compile" trick is how you'd do this right now. Would it be helpful if we added an API (either a kwarg or separate method) to get this version of the string out? Note that SQLAlchemy doesn't support literal binding for array parameters so there's currently no way to do that at the moment. |
Beta Was this translation helpful? Give feedback.
@saschahofmann That is correct, the old "double compile" trick is how you'd do this right now.
Would it be helpful if we added an API (either a kwarg or separate method) to get this version of the string out?
Note that SQLAlchemy doesn't support literal binding for array parameters so there's currently no way to do that at the moment.