-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
# datapackage-to-datasette | ||
# datapackage-to-datasette | ||
|
||
[![Build Status](https://travis-ci.org/chris48s/datapackage-to-datasette.svg?branch=master)](https://travis-ci.org/chris48s/datapackage-to-datasette) | ||
[![Coverage Status](https://coveralls.io/repos/github/chris48s/datapackage-to-datasette/badge.svg?branch=master)](https://coveralls.io/github/chris48s/datapackage-to-datasette?branch=master) | ||
[![PyPI Version](https://img.shields.io/pypi/v/datapackage-to-datasette.svg)](https://pypi.org/project/datapackage-to-datasette/) | ||
![License](https://img.shields.io/pypi/l/datapackage-to-datasette.svg) | ||
![Python Support](https://img.shields.io/pypi/pyversions/datapackage-to-datasette.svg) | ||
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg) | ||
|
||
Import Frictionless Data | ||
[Datapackage](https://frictionlessdata.io/docs/data-package/)s | ||
into SQLite and generate | ||
[Datasette metadata](https://datasette.readthedocs.io/en/stable/metadata.html). | ||
|
||
## Setup | ||
|
||
```sh | ||
pip install datapackage-to-datasette | ||
``` | ||
|
||
## Usage | ||
|
||
### On the console | ||
|
||
Import a datapackage from a local file | ||
|
||
```sh | ||
datapackage-to-datasette mydatabase.db /path/to/datapackage.json metadata.json | ||
``` | ||
|
||
or from a URL | ||
|
||
```sh | ||
datapackage-to-datasette mydatabase.db https://pkgstore.datahub.io/core/co2-ppm/10/datapackage.json metadata.json | ||
``` | ||
|
||
If the datasette metadata file already exists, you can pass | ||
`--write-mode replace` or `--write-mode merge` to overwrite | ||
or merge with the existing datasette metadata file. | ||
|
||
### As a library | ||
|
||
```py | ||
from datapackage_to_datasette import datapackage_to_datasette, DataImportError | ||
|
||
try: | ||
datapackage_to_datasette( | ||
'mydatabase.db', | ||
'/path/to/datapackage.json', | ||
'metadata.json', | ||
write_mode='replace' | ||
) | ||
except DataImportError: | ||
raise | ||
``` |