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.
Usage
After
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))
df.plot()
Installation
The package is registered on pypi, so install with
pip install saio
or get it directly from github
pip install git+https://github.com/coroa/saio.git#egg=saio
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}
Metadata
Release files for saio 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| saio-0.2.1.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| saio-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / saio-0.2.1.tar.gz
| Download URL | saio-0.2.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fc0635c160a341ecf3a5b8d3b6bf83bf4cb7d410ecb6ec63ead1c9246808d87
|
|
BLAKE2b-256 checksum How to use checksums |
198aaeb8f8f712c0b26071afbeff0b66e06007d924027938a14f653d58611562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5
|
Release files / saio-0.2.1-py3-none-any.whl
| Download URL | saio-0.2.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e737f7595e938c2a19a5aca4896ac7df5834417e1be54686b926112393e6d89
|
|
BLAKE2b-256 checksum How to use checksums |
0dc87871e89596adb4a4096d76e057a431752e315a5319fd7c9519045e698e7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5
|