-
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
Interval type column raises TypeError on record access #141
Comments
Thanks for this. |
@tomchristie This is only an issue in asyncpg cause it doesn't use A quick fix would be to hard code result processor for this and other problem data types which isn't great. Better would be to somehow coerce the asyncpg record to sqla Do you have any suggestions? |
@steinitzu there's some scope in #128, but in the nutshell, there're slight syntax differences between asyncpg and psycopg2 (aiopg). So it's worth checking the diff of rendered sql on both backends. As of Eg. :
|
This is non issue when using sqlalchemy.dialects.postgresql.INTERVAL instead of sqlalchemy.Interval. |
Hi
I found an issue when selecting from a table with an
Interval
column, this should parse to atimedelta
object.When used with databases, sqlalchemy raises a
TypeError
when trying to access the column in the result:It works fine when using the same table with sqlalchemy engine directly.
Suspecting it's because the result processor ( https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/sql/sqltypes.py#L1914 ) executes when used with databases, but not with sqlalchemy. Question is why?
My understanding is that it should not be executed for postgres cause it has a native interval type.
Here is a script to reproduce the problem:
The text was updated successfully, but these errors were encountered: