Skip to content

Instantly share code, notes, and snippets.

@Paradoxis
Last active March 15, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Paradoxis/234f070972f09bdf6c3da1586f6f564c to your computer and use it in GitHub Desktop.
Save Paradoxis/234f070972f09bdf6c3da1586f6f564c to your computer and use it in GitHub Desktop.
SqlAlchemy - Column to native Python type
from sqlalchemy import Column
def column_to_type(column: Column):
"""
Helper to get the native Python type of a column
:param column: SqlAlchemy column
:return: Python type
"""
return column.property.columns[0].type.python_type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment