Skip to main content

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

Project description

# jsontableschema-sql-py

[![Travis](https://img.shields.io/travis/frictionlessdata/jsontableschema-sql-py/master.svg)](https://travis-ci.org/frictionlessdata/jsontableschema-sql-py)
[![Coveralls](http://img.shields.io/coveralls/frictionlessdata/jsontableschema-sql-py/master.svg)](https://coveralls.io/r/frictionlessdata/jsontableschema-sql-py?branch=master)
[![PyPi](https://img.shields.io/pypi/v/jsontableschema-sql.svg)](https://pypi.python.org/pypi/jsontableschema-sql)
[![SemVer](https://img.shields.io/badge/versions-SemVer-brightgreen.svg)](http://semver.org/)
[![Gitter](https://img.shields.io/gitter/room/frictionlessdata/chat.svg)](https://gitter.im/frictionlessdata/chat)

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

```bash
pip install jsontableschema-sql
```

### Storage

Package implements [Tabular Storage](https://github.com/frictionlessdata/jsontableschema-py#storage) interface.

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

```python
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:

```python
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](http://www.sqlalchemy.org/).

## API Reference

### Snapshot

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

### Detailed

- [Docstrings](https://github.com/frictionlessdata/jsontableschema-py/tree/master/jsontableschema/storage.py)
- [Changelog](https://github.com/frictionlessdata/jsontableschema-sql-py/commits/master)

## Contributing

Please read the contribution guideline:

[How to Contribute](CONTRIBUTING.md)

Thanks!

Project details


Download files

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

Source Distribution

jsontableschema-sql-0.7.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsontableschema_sql-0.7.0-py2.py3-none-any.whl (10.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file jsontableschema-sql-0.7.0.tar.gz.

File metadata

File hashes

Hashes for jsontableschema-sql-0.7.0.tar.gz
Algorithm Hash digest
SHA256 26b099c00a3bd584685bd699cbfb440745cfaabbb62b2ff2d5e4b00886adc06b
MD5 555d4e896b24d3f9b67e7b16c0c87ae6
BLAKE2b-256 da1e5f39bc6171005e358b56cbdad705029edfe8839c4a9a80020879f0b32d63

See more details on using hashes here.

File details

Details for the file jsontableschema_sql-0.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jsontableschema_sql-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93a63011055192be2994d96050dfc7c232f1293bbf35df3f273cd1dd59aea83d
MD5 aa309bcecbbc274c858cac7a1a3d78b6
BLAKE2b-256 66e8f076041d86db84e21fa0cf48501307642b65a6524adc39eaaf789b4a6b8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page