https://github.com/davidecavestro/123table
a containerized importer for db tables
https://github.com/davidecavestro/123table
csv data-import jdbc sql table
Last synced: 10 months ago
JSON representation
a containerized importer for db tables
- Host: GitHub
- URL: https://github.com/davidecavestro/123table
- Owner: davidecavestro
- License: bsd-3-clause
- Created: 2025-03-26T17:06:23.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-04-30T17:19:51.000Z (10 months ago)
- Last Synced: 2025-04-30T17:50:09.323Z (10 months ago)
- Topics: csv, data-import, jdbc, sql, table
- Language: Groovy
- Homepage: https://davidecavestro.github.io/123table/
- Size: 283 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 123table
[](https://github.com/davidecavestro/123table/releases)
[](https://github.com/davidecavestro/123table/actions/workflows/build.yml)
[](https://davidecavestro.github.io/123table/coverage/)
_123table_ is a containerized command line tool that makes it easy to load rows into a database table.
_123table_ reads the rows from a CSV file or db table
and inserts them into a table for any JDBC-compliant database.

## Project status
Available for beta testing: the implemented features seem to work as expected.
See the roadmap below or open a PR for missing features.
## Image flavours
_123table_ is packaged into flavours for specific needs
| Flavour | Suffix | Pre-warmed | Startup | JDBC drivers | Weight |
| ------------- | ----------- |:----------:| ------- | ------------ | ------ |
| Generic | | No | Slow | Included | Heavy |
| Slim | `slim` | No | Slow | - | Light |
| Fast | `fast` | Yes | Fast | Included | Heavy |
| Fast and slim | `fast-slim` | Yes | Fast | - | Light |
Where the *fast* flavours leverage features from the https://crac.org project
in order to speed-up the container boot.
See [Image Flavours](https://davidecavestro.github.io/123table/guide/flavours.html) for more details.
The included drivers are available within the `/drivers` folder.
Currently packaged drivers cover the following data sources:
- csv
- duckdb
- h2
- MS SQLserver
- MySQL
- Oracle
- PostgreSQL
- sqlite
If other drivers become needed, just mount a volume or bind-mount
a local folder containing the appropriate jars.
See [JDBC Drivers](https://davidecavestro.github.io/123table/guide/drivers.html) for more details.
## Motivation
Beyond the obvious need to load rows into a db table, this project began
to **experiment as a developer** with the feasibility and limitations - in
2025 - of using only Groovy scripts, a Dockerfile and some bash as **a
minimalist approach to developing a small CLI tool** with some automated
test coverage and contnuous integration, but without the bells and whistles
of build tools.
## HOWTOs
### Basic usage
Given a CSV file named _foo.csv_ in the current directory, run
```bash
docker run --rm -it \
-v $(pwd):/data ghcr.io/davidecavestro/123table:fast-latest \
-stable foo \
-create \
-url jdbc:sqlite:/data/foo.db
```
to load its rows into a newly created *foo* table of a sqlite db.
Replace the `-url` value with a proper JDBC url for your target db.
Use the `--help` flag to get the full list of options or see the
[Getting Started](https://davidecavestro.github.io/123table/guide/getting-started/)
guide for further details.
### How to build locally
```bash
docker build -t 123table .
```
### How to run tests locally
#### Containerized tests
```bash
docker build --target tests -t 123table-tests . && \
docker run --rm -it -v ./target:/target 123table-tests
```
## Roadmap (sort of)
- [X] Feat: copy from CSV
- [X] Feat: plain copy - same name and type
- [x] Feat: field name remapping
- [ ] Feat: field type remapping (value computed by target type)
- [X] Feat: field value remapping (value computed by custom code)
- [x] Feat: support for additional/custom JDBC drivers
- [x] Feat: copy from db
- [x] CI: code coverage > 90%
- [x] CI: automatic tests on push
- [x] CI: show test coverage
- [x] CI: release automation