simonw / db-build

Tools for building SQLite databases from files and directories
11 stars 2 forks source link

db-build

PyPI Changelog Tests License

Tools for building SQLite databases from files and directories

Installation

Install using pip or pipx:

pip install db-build

If you have sqlite-utils installed as well, this will act as a plugin and add a sqlite-utils build command.

Usage

db-build can build databases from a number of different flat file formats.

It is always called with a SQLite database as the first argument, which can be a file that does not exist yet.

Any subsequent arguments will be treated as files or directories that should be loaded into that database.

A simple initial example, adding all CSV files in the current directory:

db-build data.db *.csv

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd db-build
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest