Reputation: 797
As far as I know, there exists no such features that gives the expected type of query result in sql without executing the query. However, I think that it's possible to implement and there could be some tricks for it.
I'm using sqlalchemy, so I hope that the solution is easy to implement with sqlalchemy. Any idea how to do this?
Upvotes: 2
Views: 484
Reputation: 15090
You can get column types from column_descriptions
[c['type'] for c in query.column_descriptions]
Or if you need to know Python types:
[c['type'].python_type for c in query.column_descriptions]
Upvotes: 3