q README

The project's README from github.com/harelba/q. As one markdown file: README.md.

Build and Package

q - Text as Data

q's purpose is to bring SQL expressive power to the Linux command line and to provide easy access to text as actual data.

q allows the following:

The following table shows the impact of using caching:

Rows Columns File Size Query time without caching Query time with caching Speed Improvement
5,000,000 100 4.8GB 4 minutes, 47 seconds 1.92 seconds x149
1,000,000 100 983MB 50.9 seconds 0.461 seconds x110
1,000,000 50 477MB 27.1 seconds 0.272 seconds x99
100,000 100 99MB 5.2 seconds 0.141 seconds x36
100,000 50 48MB 2.7 seconds 0.105 seconds x25

Notice that for the current version, caching is not enabled by default, since the caches take disk space. Use -C readwrite or -C read to enable it for a query, or add caching_mode to .qrc to set a new default.

q's web site is https://harelba.github.io/q/ or https://q.textasdata.wiki It contains everything you need to download and use q immediately.

Usage Examples

q treats ordinary files as database tables, and supports all SQL constructs, such as WHERE, GROUP BY, JOINs, etc. It supports automatic column name and type detection, and provides full support for multiple character encodings.

Here are some example commands to get the idea:

$ q "SELECT COUNT(*) FROM ./clicks_file.csv WHERE c3 > 32.3"

$ ps -ef | q -H "SELECT UID, COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"

$ q "select count(*) from some_db.sqlite3:::albums a left join another_db.sqlite3:::tracks t on (a.album_id = t.album_id)"

Detailed examples are in here

Installation.

New Major Version 3.1.6 is out with a lot of significant additions.

Instructions for all OSs are here.

The previous version 2.0.19 Can still be downloaded from here

Contact

Any feedback/suggestions/complaints regarding this tool would be much appreciated. Contributions are most welcome as well, of course.

Linkedin: Harel Ben Attia

Twitter @harelba

Email [email protected]

q on twitter: #qtextasdata

Patreon: harelba - All the money received is donated to the Center for the Prevention and Treatment of Domestic Violence in my hometown - Ramla, Israel.

q (harelba/q)

Searching Database…

10.4K ·GitHub
这是什么?q 是一个命令行工具,可以直接对带分隔符的文本文件(CSV、TSV)以及包含多个文件的 SQLite 数据库运行 SQL 查询,把这些文件当作表来查询。
它是需要在代码里导入的库,还是安装后直接运行的工具?它是一个用 Python 编写的独立命令行工具——只需安装一次,之后就能直接在终端里执行查询,不需要写代码。
我怎么把它装到自己的电脑上?从 q 的官网下载即可,官网上包含了立即上手所需的全部内容——有适用于所有操作系统的安装说明,当前的大版本是 3.1.6。
它能在我的 Mac 或 Windows 电脑上运行吗,还是只支持 Linux?它是跨平台的:README 提供了适用于所有操作系统的安装说明,并且为 Windows、macOS 和 Linux 都提供了安装包。
q 可以免费使用吗?可以——它是以 GPL-3.0 许可证开源的,没有付费版本。作者接受 Patreon 捐助,而这些钱全部捐给以色列拉姆拉的一家家庭暴力防治中心。
我查询文件时,数据会离开我的电脑吗?不会——q 是一个本地命令行工具,直接读取你电脑上的文件;整个项目完全不涉及把数据上传到服务器。
Creator
harelba
Size
3.3 MB
Stars
10.4K
Age
14y
Commits · 90 Days