ETL started out as a CLI tool to interface databases with JSON from the terminal. It became something more, with a server, where you can define API endpoints using parametrized SQL queries in a yaml configuration.
Currently, it provides:
- A CLI for writing/reading from databases using JSON
- A server that uses a .yaml definition to provide APIs
- Web development capabilities with templating from API responses (SSR)
- CQRS support by composing definitions with
include.
go install github.com/titpetric/etl/cmd/etl@main- CLI Reference – Command-line tool usage, database operations, and examples
- Configuration – Server configuration, endpoints, handlers, and options
- Server Development – API configuration, web development, and template rendering
ETL supports these major use cases:
- CLI Database Interface - Query and manipulate databases from shell scripts
- SQL-First API Development - Expose database queries as json based REST/RPC API endpoints with zero boilerplate
- Web Development - Responses can be templated, reusing existing APIs defined in the system as the data source
- CQRS Development - Composable configuration allows trivial separation of read/write statements
- SQLite
- PostgreSQL
- MySQL
The ETL CLI aims to be database agnostic. It leans into json as a
portable data format, and implements compatibility drivers to talk to
each database, storing and returning JSON with a common API.
The SQL you define on your own is not portable, as it depends on the database server in use. This allows you to use server specific syntax.
Several test suites demonstrate core functionality:
- tests/git-tags – CLI usage examples
- tests/petstore – SQL-as-API examples
- tests/users – CQRS and integrated testing
Set environment variables with your connection/storage details:
| Database | Example DSN |
|---|---|
| SQLite | export ETL_DB_DSN="sqlite://file:myapp.db" |
| PostgreSQL | `export ETL_DB_DSN="postgres://user:pass@localhost:5432/dbname" |
| MySQL | export ETL_DB_DSN="mysql://user:pass@tcp(localhost:3306)/dbname" |
Standard database clients (psql, mysql -e) require mastering database-specific syntax and CLI arguments and flags.
ETL provides:
- Unified interface across SQLite, PostgreSQL, and MySQL
- First-class JSON support for input/output
- Simple insert/update operations via JSON or arguments
- Custom SQL query capability for complex operations
- Rapid API development without boilerplate
- Web application rendering alongside API servers
Use with jq, yq, or other standard tools for data transformation pipelines.
- go-bridget/mig – For database migrations
- titpetric/vuego – Template engine
- titpetric/platform – HTTP server framework