-
Notifications
You must be signed in to change notification settings - Fork 435
-
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:
for column_name, db_api_type_code, *_rest in result.cursor.description:
The .description
property gives me tuples like the following:
>> ('id', 1043, None, None, None, None, None) >> ('name', 1043, None, None, None, None, None)
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
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment