Skip to content

davidecavestro/123table

Repository files navigation

123table

GitHub release (latest by date) build 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.

Duckdb example

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.

Project logo

╭───┬───┬───╮
│ 1 │ 2 │ 3 │
├───┼───┼───┤
│ t │ a │ + │
├───┼───┼───┤
│ b │ l │ e │
╰───┴───┴───╯

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 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 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

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 guide for further details.

How to build locally

docker build -t 123table .

How to run tests locally

Containerized tests

docker build --target tests -t 123table-tests . && \
docker run --rm -it -v ./target:/target 123table-tests

Roadmap (sort of)

  • Feat: copy from CSV
  • Feat: plain copy - same name and type
  • Feat: field name remapping
  • Feat: field type remapping (value computed by target type)
  • Feat: field value remapping (value computed by custom code)
  • Feat: support for additional/custom JDBC drivers
  • Feat: copy from db
  • CI: code coverage > 90%
  • CI: automatic tests on push
  • CI: show test coverage
  • CI: release automation

About

a containerized data loader for db tables

Topics

Resources

License

Stars

Watchers

Forks

Packages