https://github.com/chris48s/datapackage-to-datasette
📦 Import Frictionless Data Datapackages into SQLite and generate Datasette metadata
https://github.com/chris48s/datapackage-to-datasette
data-packages datasette frictionlessdata sqlite
Last synced: 11 months ago
JSON representation
📦 Import Frictionless Data Datapackages into SQLite and generate Datasette metadata
- Host: GitHub
- URL: https://github.com/chris48s/datapackage-to-datasette
- Owner: chris48s
- License: mit
- Created: 2019-11-08T20:06:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-04T19:49:13.000Z (about 1 year ago)
- Last Synced: 2025-05-06T12:59:08.148Z (about 1 year ago)
- Topics: data-packages, datasette, frictionlessdata, sqlite
- Language: Python
- Homepage: https://pypi.org/project/datapackage-to-datasette/
- Size: 893 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# datapackage-to-datasette
[](https://github.com/chris48s/datapackage-to-datasette/actions/workflows/test.yml)
[](https://codecov.io/gh/chris48s/datapackage-to-datasette)
[](https://pypi.org/project/datapackage-to-datasette/)



Import Frictionless Data
[Datapackage](https://frictionlessdata.io/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
```