Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/db-build
Tools for building SQLite databases from files and directories
https://github.com/simonw/db-build
Last synced: 27 days ago
JSON representation
Tools for building SQLite databases from files and directories
- Host: GitHub
- URL: https://github.com/simonw/db-build
- Owner: simonw
- Created: 2023-08-15T01:26:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-15T01:49:53.000Z (about 1 year ago)
- Last Synced: 2024-10-07T13:53:39.646Z (about 1 month ago)
- Size: 2.93 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# db-build
[![PyPI](https://img.shields.io/pypi/v/db-build.svg)](https://pypi.org/project/db-build/)
[![Changelog](https://img.shields.io/github/v/release/simonw/db-build?include_prereleases&label=changelog)](https://github.com/simonw/db-build/releases)
[![Tests](https://github.com/simonw/db-build/workflows/Test/badge.svg)](https://github.com/simonw/db-build/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/db-build/blob/main/LICENSE)Tools for building SQLite databases from files and directories
## Installation
Install using `pip` or `pipx`:
```bash
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:
```bash
db-build data.db *.csv
```## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd db-build
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```