Skip to content

Generate SQL tables, load and extract data, based on JSON Table Schema descriptors.

License

Notifications You must be signed in to change notification settings

zhuyansen/jsontableschema-sql-py

 
 

Repository files navigation

jsontableschema-sql-py

Travis Coveralls PyPi SemVer Gitter

Generate and load SQL tables based on JSON Table Schema descriptors.

Version v0.3 contains breaking changes:

  • renamed Storage.tables to Storage.buckets
  • changed Storage.read to read into memory
  • added Storage.iter to yield row by row

Getting Started

Installation

pip install jsontableschema-sql

Storage

Package implements Tabular Storage interface.

SQLAlchemy is used as sql wrapper. We can get storage this way:

from sqlalchemy import create_engine
from jsontableschema_sql import Storage

engine = create_engine('sqlite:///:memory:', prefix='prefix')
storage = Storage(engine)

Then we could interact with storage:

storage.buckets
storage.create('bucket', descriptor)
storage.delete('bucket')
storage.describe('bucket') # return descriptor
storage.iter('bucket') # yield rows
storage.read('bucket') # return rows
storage.write('bucket', rows)

Mappings

schema.json -> SQL table schema
data.csv -> SQL talbe data

Drivers

SQLAlchemy is used - docs.

API Reference

Snapshot

https://github.com/frictionlessdata/jsontableschema-py#snapshot

Detailed

Contributing

Please read the contribution guideline:

How to Contribute

Thanks!

About

Generate SQL tables, load and extract data, based on JSON Table Schema descriptors.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.0%
  • Makefile 2.0%