Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

textql

> 编程语言
Open source

Execute SQL against structured text like CSV or TSV

9.1K stars0 likes3 views
WebsiteGitHub

About

Execute SQL against structured text like CSV or TSV

TextQL

Allows you to easily execute SQL against structured text like CSV or TSV.

Example session:

Major changes!

In the time since the initial release of textql, I've made some improvements as well as made the project much more modular. There've also been additional performance tweaks and added functionality, but this comes at the cost of breaking the original command-line flags and changing the install command.

Changes since v1

Additions:

  • Numeric values are automatically recognized in more cases.
  • Date / Time / DateTime values are automatically recognized in reasonable formats. See Time Strings for a list for accepted formats, and how to convert from other formats.
  • Added join support! Multiple files / directories can be loaded by listing them at the end of the command.
  • Directories are read by reading each file inside, and this is non-recursive.
  • You can list as many files / directories as you like.
  • Added flag '-output-file' to save output directly to a file.
  • Added flag '-output-dlm' to modify the output delimiter.
  • Added "short SQL" syntax.
    • For the case of a single table, the FROM [table] can be dropped from the query.
    • For simple selects, the SELECT keyword can be dropped from the query.
    • This means the v1 command textql -sql "select * from tbl" -source some_file.csv can be shortened to textql -sql "*" some_file.csv

Changes:

  • The flag '-outputHeader' was renamed to '-output-header'.

Removals:

  • Dropped the ability to override table names. This makes less sense after the automatic tablename generation based on filename, joins, and shorter SQL syntax changes.
  • Removed '-source', any files / paths at the end of the command are used, as well as piped-in data.

Bug fixes:

  • Writing to a directory no longer fails silently.

Key differences between textql and sqlite importing

  • sqlite import will not accept stdin, breaking unix pipes. textql will happily do so.
  • textql supports quote-escaped delimiters, sqlite does not.
  • textql leverages the sqlite in-memory database feature as much as possible and only touches disk if asked.

Is it any good?

Yes

Requirements

  • Go 1.4 or later

Install

Latest release on Homebrew (OS X)

bash
brew install textql

Build from source

bash
go get -u github.com/dinedal/textql/...

Docker

First build the image.

bash
docker build -t textql .

Now use that image mounting your current directory into the container.

bash
docker run --rm -it -v $(pwd):/tmp textql [rest_of_command]

Alias

You can add the following alias to your system to provide quick access to TextQL:

bash
alias textql='docker run --rm -it -v $(pwd):/tmp textql '

AUR

Using an AUR-Helper

bash
yaourt textql-git

Building from PKGBUILD First clone the repository.

bash
makepkg -cs

Then install the package using pacman or your favorite Package Manager

Usage

…

I want stdev, average, other functions

Just follow the install directions at go-sqlite3-extension-functions and textql will automatically load this library.

Full function list:

  • Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi.
  • String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter.
  • Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile

License

New MIT License - Copyright (c) 2015, 2016 Paul Bergeron http://pauldbergeron.com/

See LICENSE for details

Issues· 38 open

View all issuesOpen on GitHub
  • #145

    "brew install textql" doesn't work anymore

    Updated Aug 19, 2025
  • #142

    no such function: timediff

    Updated Jan 13, 2024
  • #140

    Neither CONCAT nor || are working for concatenating

    Updated Jun 18, 2023
  • #139

    request a new release

    Updated Dec 1, 2022
  • #137

    Magicify() sometimes turnes double quotes into single quotes

    Updated Mar 9, 2022
  • #135

    TestCSVInputHasAName fails with Go 1.17

    Updated Sep 15, 2021
  • #134

    Webservice version

    Updated Aug 13, 2021
  • #112

    Cannot spawn a Docker container running as unprivileged user

    Updated Mar 14, 2021
  • #131

    Release new version with go modules

    Updated Feb 22, 2021
  • #105

    Infinite loop generating newlines with semicolon and newline in the query

    Updated Jan 21, 2021

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言