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-hypernode.com/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.6.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

jsontableschema_sql-0.6.1-py2.py3-none-any.whl (9.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for jsontableschema-sql-0.6.1.tar.gz
Algorithm Hash digest
SHA256 96bc15bce2251120be631d70f9ae8f1d5211abf750a1ca3b3b85201bd25c5b0b
MD5 e198e0fa172f3852c29a8bf909f2953b
BLAKE2b-256 8a62b35fcbcc0f35031af5218f059f7a9a1895550b90409a88a1071f1e9baa9f

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for jsontableschema_sql-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fd4733a9b9a04f04fbf653d46f13a1219489de20a3ce2b30d3048003ed5f1901
MD5 dda0f142cf8e0464a9af03e2b22e6071
BLAKE2b-256 41172d54da54f0820a47866be8ec3a428343bb8828f7b1d336e7cb3950dd1e7f

See more details on using hashes here.

Provenance

Supported by

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