DEV Community

petercour
petercour

Posted on

3 1

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:

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay