-
Notifications
You must be signed in to change notification settings - Fork 261
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
Simple query that works with sqlalchemy fails with databases #128
Comments
Steps to progress this issue would include:
The exception itself is from the |
It looks like it's due to a subtle difference in the underlying driver.
that will raise an exception at the
and to resolve the confusion asyncpg expects it as
Another way to resolve it would be to define the query as
that doesn't confuse asyncpg. For
that it can execute. |
Is this resolvable for us? Is there anything we can set in the dialect that'd ensure the query gets compiled to |
@tomchristie I'm not sure, it's getting tricky as In this particular case It's a quite confusing point to me as I'm afraid it might get pretty complicated to control the query rendering might require to go quite deep in adjusting the sqlalchemy logic, where it might have more sense to do at the ORM level. However, on the other hand, we have integration with sqlalchemy core already. |
May be worth looking into if |
Any updates on this issue? |
Another solution: compile the query as a string with your database's dialect and use the "literal_binds" kwarg when compiling. This substitutes the parameters into raw SQL which can be dangerous if the parameters are from an untrusted input. Here's an example for PostgreSQL:
Annoying since you'd have to do this for every query, but I'm using a custom subclass of |
A simple
COUNT(*)
works usingsqlalchemy.Engine.execute()
, but fails usingdatabases.Database.fetch_all()
, raising anIndeterminateDatatypeError
exception.The text was updated successfully, but these errors were encountered: