Do not follow this link

~nilium/sql

Tool to query any RDBMS with JSON output
Add Nix flake
Upgrade minimum Go version and dependencies
Add jq::expr argument support

clone

read-only
https://git.sr.ht/~nilium/sql
read/write
git@git.sr.ht:~nilium/sql

You can also use your local clone with git send-email.

#sql(1)

sql(1) is a small Go tool to query relational databases with JSON output. It supports passing arguments with placeholders, parameter expansion as in column IN (?) via sqlx, and execution of multiple statements. It's intended for use along with tools like jq and miller.

#Building

To build the sql binary, you need Go 1.16 or later installed. You can then use go build as usual to build, or bmake bin/sql. Currently, there is no difference between the two.

To build the man page, you need [scdoc] installed. You can then use bmake sql.1 to build the man pages.

Currently, MySQL and Postgres support is built in by default, but can be omitted by setting the build tags omit_mysql or omit_postgres, as desired. This shouldn't have much relevance to users, but may be more important in the future if drivers that require C are added. You can pass these tags to the bmake by setting the GO_TAGS variable to one or more space or comma-separated tags. For example: bmake GO_TAGS=omit_mysql.

#Installation

Pre-built binaries are not available for sql(1) right now, so you'll need to build and install it yourself:

$ git clone https://git.sr.ht/~nilium/sql
$ cd sql

# Optional: check out a version.
$ git checkout v0.1.0

# Build the program:
$ bmake all
$ bin/sql -h
Usage: sql [OPTIONS] <DSN> {QUERY [ARGS...]...}
...

# Optional: install to a PREFIX.
$ sudo bmake install

When running bmake install, you can optionally set the PREFIX variable to change the install location. This defaults to /usr/local. you can also set either MAN_PREFIX (default: $PREFIX/share/man) or BIN_PREFIX (default: $PREFIX/bin) to set the path that man pages and binaries are installed to, respectively.

#Usage

Currently, only the included scdoc man page under sql.1.scd provides usage information. If you have scdoc, this can be compiled to a man page to view it in man(1). See the Building section above.

#License

The sql tool is licensed under the GNU GPL v3.0. A copy of the license is provided in the COPYING text in this source tree, but may also be read at https://www.gnu.org/licenses/.

Do not follow this link