Skip to main content

SQLAlchemyIO (saio): Module hack for autoloading table definitions

Project description

SQLAlchemyIO (saio)

Module hack for autoloading table definitions.

Also provides a helper function as_pandas to read an sqlalchemy.orm.query.Query into a (Geo)Pandas dataframe.



import saio
saio.register_schema("model_draft", engine)

one can import table declarations easily using

from saio.model_draft import lis_charging_poi as LisChargingPoi

Note that ipython and Jupyter Notebook, allow using <TAB> to auto-complete table names.

The helper function as_pandas reads a query into a GeoDataFrame:

saio.register_schema("boundaries", engine)

from saio.boundaries import bkg_vg250_2_lan as BkgLan
df = saio.as_pandas(session.query(BkgLan))


Until we decide to register this package with pypi and/or conda-forge, please install it directly from git using pip:

pip install git+

or add it to the environment.yaml file you are working with as

name: ...
  - [ ... ]
  -  [ ... ]
  - pip:
    - [ ... ]
    - git+

Implementation details

saio.register_schema instantiates a declarative base using

from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base(bind=engine)
# The Base can be imported using from saio.model_draft import Base

and then whenever one imports any table from saio.model_draft, ie. by calling from saio.model_draft import lis_charging_poi as LisChargingPoi, saio does approximately

class LisChargingPoi(Base):
    __tablename__ =  'lis_charging_poi'
    __table_args__ = {'schema': 'model_draft', 'autoload': True}

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
saio-0.2-py3-none-any.whl (5.0 kB) Copy SHA256 hash SHA256 Wheel py3
saio-0.2.tar.gz (4.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page