Install sqly on Ubuntu 26.04

Install sqly on Ubuntu 26.04

The sqly is a command-line tool for executing SQL queries against data files. It automatically imports supported files into an SQLite in-memory database, allowing SQL operations such as filtering, joins, and aggregations, without setting up a separate database server. The sqly supports CSV, TSV, JSON, JSONL, and more. This tutorial shows how to install sqly on Ubuntu 26.04.

Install sqly

Retrieve the latest sqly release version from the GitHub:

SQLY_VERSION=$(curl -s "https://api.github.com/repos/nao1215/sqly/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Download the matching archive and place the sqly executable in the /usr/local/bin:

curl -sSL https://github.com/nao1215/sqly/releases/latest/download/sqly_${SQLY_VERSION}_linux_amd64.tar.gz \
  | sudo tar xz -C /usr/local/bin sqly

Check the sqly version to verify that the command is available:

sqly --version

Testing sqly

A small CSV file can be prepared for testing:

echo -e 'name,age\nJohn,25\nJames,29\nOliver,35\nEmma,31' > test.csv

Table name test is derived from the input file name test.csv. Run an SQL statement against the CSV file and select the name column:

sqly --sql 'SELECT name FROM test' test.csv

The command produces the following output:

+--------+
|  name  |
+--------+
| John   |
| James  |
| Oliver |
| Emma   |
+--------+

Uninstall sqly

If the sqly is no longer required, remove the executable from the system:

sudo rm -rf /usr/local/bin/sqly

The sqly configuration directory can also be removed:

rm -rf ~/.config/sqly

Leave a Comment

Cancel reply

Your email address will not be published.