trdsql
trdsql is a CLI tool that executes SQL queries directly on CSV, JSON, YAML, LTSV, and TBLN files without requiring a database setup. It supports PostgreSQL and MySQL SQL syntax and outputs results in multiple formats, making it useful for ad-hoc data transformation and analysis.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | noborus/trdsql |
| Owner | noborus |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 2.2k |
| Forks | 78 |
| Open issues | 14 |
| Latest release | v1.2.3 (2026-05-29) |
| Last updated | 2026-07-05 |
| Source | https://github.com/noborus/trdsql |
What trdsql is
Written in Go, trdsql uses SQLite3 (via go-sqlite3 or pure-Go sqlite) as its query engine and can connect to PostgreSQL or MySQL backends. It parses various text-based data formats into SQL-queryable tables, supporting jq expressions for JSON input and offering compression (gzip, bz2, zstd, lz4, xz) for output.
Get the trdsql source
Clone the repository and explore it locally.
git clone https://github.com/noborus/trdsql.gitcd trdsql# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- NULL handling must be explicitly configured per run (specify -inull and -onull for non-JSON formats); default is empty string = NULL.
- Column name and type inference happen during parsing; inconsistent columns in input may cause silent truncation or errors.
- CGO dependency on go-sqlite3 can complicate cross-compilation; use CGO_ENABLED=0 with pure-Go sqlite for portability but expect ~10-20% performance penalty.
- Memory usage grows linearly with input file size; pre-filter or limit rows with -ilr to avoid OOM on large files.
- jq expressions for JSON input require jq syntax familiarity; complex transformations may be easier in post-processing scripts.
When to avoid it — and what to weigh
- Large-scale data processing — In-memory SQLite execution limits practical file sizes; not suitable for multi-gigabyte datasets or production data warehouses.
- Real-time streaming ingestion — Designed for batch file processing; does not support real-time event streams or incremental updates.
- Complex ACID transactions — Single-file execution context provides no multi-table transactions, distributed commits, or rollback semantics.
- Proprietary or binary formats — Requires human-readable text input (CSV, JSON, YAML); cannot directly query Avro, Parquet, Protocol Buffers, or databases without export.
License & commercial use
MIT License: permissive, allows commercial use, modification, and distribution with inclusion of license and copyright notice. No patent grant clause.
MIT is a permissive OSI-approved license. Commercial use is legally permitted. No additional licensing fees or restrictions. Verify compliance with your own legal counsel for liability and warranty disclaimers implicit in MIT.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
No embedded secrets management. Executes user-supplied SQL; no sandboxing—malformed queries or SQL injection via user input is possible if input is untrusted. File-based operation avoids network exposure. No built-in audit logging. Review SQL context if handling untrusted input.
Alternatives to consider
q (harelba/q)
Similar CLI for CSV/TSV queries using SQLite. Lightweight, but less format variety and no PostgreSQL/MySQL syntax support.
textql (dinedal/textql)
Older CLI for CSV→SQL; actively superseded by trdsql. Smaller feature set and less maintained.
DuckDB CLI
Modern OLAP engine with broader format support (Parquet, JSON, CSV) and faster performance on large files. More heavyweight, better for analytics.
Build on trdsql with DEV.co software developers
trdsql is ideal for scripted data transformation and ad-hoc file queries. Explore its CLI and Docker image to integrate into your pipeline.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
trdsql FAQ
Can trdsql query files > 10 GB?
Does trdsql support real-time tailing of log files?
Can I use trdsql in Docker without CGO?
What is the output if a NULL value is encountered in CSV input?
Software development & web development with DEV.co
Adopting trdsql is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.
Need lightweight SQL processing for text data?
trdsql is ideal for scripted data transformation and ad-hoc file queries. Explore its CLI and Docker image to integrate into your pipeline.