Generate and load SQL tables based on Data Package.
This section is intended to be used by end-users of the library.
See section below how to get tabular storage object.
High-level API is easy to use.
Having Data Package in current directory we can import it to sql database:
import dpsql
dpsql.import_package(<storage>, 'descriptor.json')
Also we can export it from sql database:
import dpsql
dpsql.export_package(<storage>, 'descriptor.json', 'datapackage_name')
SQLAlchemy is used as sql wrapper. We can get storage this way:
import jtssql
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
storage = jtssql.Storage(engine)
See jsontableschema layer readme.
datapackage.json -> *not stored*
datapackage.json resources -> sql tables
data/data.csv schema -> sql table schema
data/data.csv data -> sql table data
This section is intended to be used by tech users collaborating on this project.
To activate virtual environment, install
dependencies, add pre-commit hook to review and test code
and get run
command as unified developer interface:
$ source activate.sh
The project follow the next style guides:
To check the project against Python style guide:
$ run review
To run tests with coverage check:
$ run test
Coverage data will be in the .coverage
file.