trdsql
SQL queries on structured data files
TLDR
Query CSV
SYNOPSIS
trdsql [-i format] [-o format] [options] query
DESCRIPTION
trdsql executes SQL queries directly against structured data files such as CSV, JSON, and LTSV without importing them into a database first. File names are used as table names in SQL statements, making it straightforward to filter, aggregate, and transform data using familiar SQL syntax.
The tool supports joining data across multiple files, enabling relational queries between different data sources in a single command. Input and output formats can be specified independently, allowing conversion between formats as a side effect of querying.
Under the hood, trdsql uses SQLite as the default query engine but can also connect to PostgreSQL and MySQL for more advanced SQL features. Headers in CSV files can be used as column names with the -ih flag.
PARAMETERS
-i FORMAT
Input format (csv, json, ltsv).-o FORMAT
Output format.-ih
Input has header.-oh
Output header.-d DELIM
Delimiter.
CAVEATS
Go-based tool. Large files in memory. SQL knowledge needed.
HISTORY
trdsql was created to execute SQL queries against various structured data formats like CSV and JSON.
