Skip to content

Instantly share code, notes, and snippets.

@di3mus
di3mus / sqlalchemy-orm-query-to-dataframe.py
Created March 27, 2018 01:28 — forked from garaud/sqlalchemy-orm-query-to-dataframe.py
Example to turn your SQLAlchemy Query result object to a pandas DataFrame
# -*- coding: utf-8 -*-
"""From a Query.all(), turn this result to a pandas DataFrame
Table creation and example data come from the official SQLAlchemy ORM
tutorial at http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Just take a look at the 'query_to_dict' function and the last part of the __main__.
"""