DEV.co
Open-Source Databases · harelba

q

q is a command-line tool that lets you run SQL queries directly on CSV, TSV, and other delimited text files, as well as SQLite databases, without converting or importing data first. It caches query results to dramatically speed up repeated queries on large files.

Source: GitHub — github.com/harelba/q
10.4k
GitHub stars
423
Forks
Python
Primary language
GPL-3.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryharelba/q
Ownerharelba
Primary languagePython
LicenseGPL-3.0 — OSI-approved
Stars10.4k
Forks423
Open issues130
Latest releasev3.1.6 (2021-11-26)
Last updated2026-02-06
Sourcehttps://github.com/harelba/q

What q is

Written in Python, q parses delimited text files as virtual tables and executes SQL statements (SELECT, WHERE, GROUP BY, JOIN, etc.) against them via an embedded SQLite engine. Optional disk-based caching can accelerate repeated queries by 25–150× depending on data volume and column count.

Quickstart

Get the q source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/harelba/q.gitcd q# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Ad-hoc Analytics on Log Files and CSVs

Rapidly query large CSV or TSV exports without importing into a database. Useful for DevOps, data analysts, and engineers analyzing system logs, metrics exports, or bulk-exported data.

Multi-file SQLite Queries

Run JOIN and aggregate queries across multiple SQLite databases without merging or loading into memory. Common for data pipelines that produce separate SQLite outputs.

Lightweight Command-line Data Exploration

Replace manual grep/awk/cut chains with expressive SQL for filtering, grouping, and aggregating tabular data in shell scripts and CI/CD pipelines.

Implementation considerations

  • Installation via package manager or direct download from project site; no complex dependencies noted. Verify Python version compatibility for your environment.
  • Caching is disabled by default due to disk usage; explicitly enable with `-C readwrite` or `-C read` flags or via `.qrc` config file to realize performance gains.
  • Column auto-detection works for most common delimiters; may require manual column specification for edge cases (unusual encodings, nested delimiters).
  • For very large files (multi-GB), on-disk caching is essential; understand cache storage location and cleanup requirements.
  • Encoding support is stated; test with non-UTF-8 data in your pipeline to confirm compatibility.

When to avoid it — and what to weigh

  • Real-time or High-frequency Querying — q parses and caches on disk; not designed for millisecond-latency queries or streaming data. Use a real database for production OLTP workloads.
  • Complex Data Validation or Transformation Pipelines — q is a query tool, not an ETL framework. For multi-step transformations, data quality checks, and schema enforcement, consider dbt, Apache Beam, or dedicated data pipeline tools.
  • Enterprise Multi-user Access Control — No user authentication, row-level security, or audit logging. Not suitable for shared production databases or compliance-heavy environments.
  • Windows as Primary Platform — Tool is optimized for Linux/Unix environments. Windows support exists but is not the primary target; verify compatibility for your use case.

License & commercial use

Licensed under GPL-3.0 (GNU General Public License v3.0). This is a strong copyleft license requiring that any derivative work or distribution must also be released under GPL-3.0.

GPL-3.0 is a copyleft license. You may use q commercially for internal analysis and querying. However, if you integrate q into a product you distribute, ship, or license to others, the entire product must be released under GPL-3.0. Requires legal review before incorporating into proprietary tools or products.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitPossible
Assessment confidenceHigh
Security considerations

q executes SQL on local files with no authentication layer. Ensure only trusted users have access to the tool and input files. No mention of input sanitization, SQL injection prevention, or threat modeling. If processing untrusted CSV data, review for malformed input handling. No encryption for cached files; cache is stored on disk unencrypted. Not suitable for sensitive data without additional file-system security controls.

Alternatives to consider

DuckDB

Modern columnar SQL engine with similar file-querying capabilities, faster performance on large datasets, and active development. Available as library or CLI. Apache 2.0 license is more permissive.

ClickHouse Local

Designed for large-scale analytics on local files; offers superior performance for multi-billion-row queries. Steeper learning curve; not as lightweight as q.

SQLite CLI

Native SQLite command-line tool; requires manual import/conversion step. No caching or CSV auto-parsing, but offers full SQL and zero external dependencies.

Software development agency

Build on q with DEV.co software developers

If you need to query large text files or multi-file SQLite databases from the CLI, test q in a non-critical environment first. Verify GPL-3.0 license terms with your legal team if you plan to distribute or integrate it into products.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

q FAQ

Does q require a database server?
No. q is a standalone CLI tool that runs on your local machine. It parses files and executes queries locally using an embedded SQLite engine.
What file formats does q support?
CSV, TSV, and other character-delimited text formats. Also supports native SQLite databases (.sqlite3). Auto-detection of delimiters and column types is available.
Is caching enabled by default?
No. Caching is disabled by default to avoid unwanted disk usage. Enable with `-C readwrite` or `-C read` flags, or set `caching_mode` in `.qrc` config.
Can I use q in production?
For ad-hoc analysis and internal data exploration, yes. For serving queries to end-users or as part of a distributed application, use a proper database. Verify GPL-3.0 license compatibility if bundling into products.

Software developers & web developers for hire

Need help beyond evaluating q? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Evaluate q for Your Team

If you need to query large text files or multi-file SQLite databases from the CLI, test q in a non-critical environment first. Verify GPL-3.0 license terms with your legal team if you plan to distribute or integrate it into products.