theseus-rs / rsql

Command line interface for CockroachDB, DuckDB, LibSQL, MariaDB, MySQL, PostgreSQL, Redshift, Snowflake, SQLite3 and SQL Server
https://theseus-rs.github.io/rsql/rsql_cli/
Apache License 2.0
129 stars 5 forks source link
cockroachdb command-line data database duckdb mariadb mysql postgres postgresql redshift rust snowflake sql sqlite sqlite3 sqlserver

rsql

ci Documentation Code Coverage Benchmarks Latest version Github All Releases License Semantic Versioning

rsql is a command line interface for databases. rsql is a modern, feature-rich, and user-friendly database client, that has been designed to be easy to use, and to provide a consistent experience across all supported databases. The project aims to provide reusable components for building other database clients.

Getting Started

rsql can be installed using the following methods:

Linux / MacOS

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.sh | sh

Windows

irm https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.ps1 | iex

For more information, and additional installations instructions (cargo, homebrew, msi), visit the rsql site.

Features

Feature
Databases CockroachDB, DuckDB, LibSQL (Turso), MariaDB, MySQL, PostgreSQL, Redshift, Snowflake, SQLite3, SQL Server
Syntax Highlighting
Result Highlighting
Query Auto-completion
History
SQL File Execution
Embedded PostgreSQL
Output Formats ascii, csv, expanded, html, json, jsonl, markdown, plain, psql, sqlite, tsv, unicode, xml, yaml
Localized Interface 40+ languages¹
Key Bindings emacs, vi

¹ Computer translations; human translations welcome

Usage

Interactive Mode

rsql --url "<url>"

Running a single Query

rsql --url "<url>" -- "<query>"
Driver URL
cockroachdb (sqlx) cockroachdb://<user[:password>]@<host>[:<port>]/<database>
duckdb duckdb://?<memory=true>[&file=<database_file>]
libsql¹ libsql://<host>?[<memory=true>][&file=<database_file>][&auth_token=<token>]
mariadb (sqlx) mariadb://<user>[:<password>]@<host>[:<port>]/<database>
mysql (sqlx) mysql://<user>[:<password>]@<host>[:<port>]/<database>
postgres postgres://<user>[:<password>]@<host>[:<port>]/<database>?<embedded=true>
postgresql (sqlx) postgresql://<user>[:<password>]@<host>[:<port>]/<database>?<embedded=true>
redshift (sqlx) redshift://<user[:password>]@<host>[:<port>]/<database>
rusqlite rusqlite://?<memory=true>[&file=<database_file>]
snowflake snowflake://<user>[:<token>]@<account>.snowflakecomputing.com/[?private_key_file=pkey_file&public_key_file=pubkey_file]
sqlite (sqlx) sqlite://?<memory=true>[&file=<database_file>]
sqlserver sqlserver://<user>[:<password>]@<host>[:<port>]/<database>

¹ libsql needs to be enabled with the libsql feature flag; it is disabled by default as it conflicts with rusqlite.

Safety

These crates use #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

Licensed under either of:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

<img src="https://img.shields.io/static/v1?label=VSCode%20Development%20Container&logo=visualstudiocode&message=Open&color=orange" alt="VSCode Development Container" />
<img src="https://img.shields.io/static/v1?label=GitHub%20Codespaces&logo=github&message=Open&color=orange" alt="GitHub Codespaces" />