7,363 open-source and SaaS tools, with GitHub stats refreshed every day.

q

Open source

q is a command-line tool that runs SQL queries directly on CSV, TSV and other delimited text files and on SQLite databases.

harelba.github.io
q homepage screenshot
GitHub stars
10k
Last commit
7 mo ago
Repository age
14 years
Version
v3.1.6
Licence
GPL-3.0
Self-hosted
Yes

About q

q is a command-line tool that brings SQL to text files. Rather than importing a CSV or TSV into a database first, you point q at the file and run a SELECT statement against it, treating delimited text as an actual table with columns named c1 through cN or taken from a header row.

It supports configurable delimiters, header handling and encodings, and can automatically cache data in a SQLite file so repeated queries on the same large file run faster. It can also query multi-file SQLite databases directly. The project website includes many examples, from simple selects to joins and analysis tasks, along with notes on limitations and the rationale for why existing Linux tools were not enough.

The tool is written in Python, uses SQLite internally and is released under the GPL-3.0 licence. It is installed locally and runs on your machine with no server. It suits developers, sysadmins and analysts who spend time in the terminal inspecting logs, exports and spreadsheets, and who would rather write SQL than chain awk, cut and sort commands.

Key features

  • Run SQL directly on CSV and TSV files
  • Automatic caching for repeated queries
  • Direct querying of SQLite databases
  • Configurable delimiters and headers
  • Joins across multiple text files
  • Command-line friendly output

Good fit for

  • →Quickly analyzing CSV exports in the terminal
  • →Replacing awk and sort pipelines with SQL
  • →Joining log files and lookup tables
Built with
Python
SQLite
Tags
sql
csv
tsv
cli
command-line
sqlite
python
data-analysis
text-as-data

q: questions and answers

What is q used for?
q is a command-line tool that runs SQL queries directly on CSV, TSV and other delimited text files and on SQLite databases. It is a good fit for quickly analyzing CSV exports in the terminal, replacing awk and sort pipelines with SQL, and joining log files and lookup tables.
Is q open source?
Yes. q is open source under the GPL-3.0 licence. Its source code is on GitHub at harelba/q and is written mainly in Python.
Is q free?
Yes. q is open source, so the software itself is free to use.
What are some alternatives to q?
Similar open-source tools in the Database Tools category include Goose, Pgloader and Harlequin. SaaS products in the same category include Base, Valentina Studio and AI2sql.
Is q actively maintained?
The most recent commit to q was on 6 February 2026, and the latest release is v3.1.6, published on 26 November 2021. The project has 10k stars on GitHub.

Open-source alternatives to q

See all

SaaS alternatives to q

See all