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've been developing a system with dynamically created SQL queries. Now, I need to determine the types of columns based on the types presented in the query result.
I am using asyncpg as a driver and SQLAlchemy as an ORM. I've managed to get database type codes from the asyncpg result using properties on SQLAlchemy's cursor like this:
Now, I would like to know if there is a way to get Python types from known DB type codes without creating my own dictionary, where the key is the type code and the value is the corresponding Python type.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I've been developing a system with dynamically created SQL queries. Now, I need to determine the types of columns based on the types presented in the query result.
I am using asyncpg as a driver and SQLAlchemy as an ORM. I've managed to get database type codes from the asyncpg result using properties on SQLAlchemy's cursor like this:
The
.description
property gives me tuples like the following:Now, I would like to know if there is a way to get Python types from known DB type codes without creating my own dictionary, where the key is the type code and the value is the corresponding Python type.
Beta Was this translation helpful? Give feedback.
All reactions