Is there a solution converting a SQLAlchemy <Query object>
to a pandas DataFrame?
Pandas has the capability to use pandas.read_sql
but this requires use of raw SQL. I have two reasons for wanting to avoid it:
- I already have everything using the ORM (a good reason in and of itself) and
- I'm using python lists as part of the query, e.g.:
db.session.query(Item).filter(Item.symbol.in_(add_symbols)
whereItem
is my model class andadd_symbols
is a list). This is the equivalent of SQLSELECT ... from ... WHERE ... IN
.
Is anything possible?