DEV Community

petercour
petercour

Posted on

SQL on CSV, LTSV, JSON and TBLN.

You can run SQL queries on CSV, LTSV, JSON and TBLN formats. To do that, you can use a golang program called trdsql

These files are just files, but using the tool the query language SQL becomes available. SQL is often used to query databases.

For example:

$ trdsql "SELECT * FROM test.csv"

In this case a csv file is a single database table. It also supports ASCII outputting:

$ trdsql -oat "SELECT * FROM test.csv"

+----+--------+
| C1 |   C2   |
+----+--------+
|  1 | Orange |
|  2 | Melon  |
|  3 | Apple  |
+----+--------+

Neat right?

See the gif:

Learn golang:

Top comments (0)