Command line SQL interface for relational databases and common data file formats
See the code
A modern, feature-rich command line SQL interface for data
rsql is a powerful and user-friendly command line SQL client that works with over 20 different
data sources and formats. Whether you're working with databases, files, or cloud services, rsql
provides a consistent and intuitive interface for all your data querying needs.
Linux / MacOS:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.sh | sh
or Homebrew:
brew install rsql
Windows:
irm https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.ps1 | iex
Cargo
cargo install rsql_cli
For detailed installation instructions, visit the rsql documentation.
Interactive Mode:
# Connect to a database
rsql --url "postgresql://user:pass@localhost/mydb"
# Query a CSV file
rsql --url "csv://data.csv"
# Use DuckDB for in-memory analytics
rsql --url "duckdb://"
Execute Single Query:
# Run a query and exit
rsql --url "sqlite://database.db" -- "SELECT * FROM users LIMIT 10"
# Query a Parquet file
rsql --url "parquet://data.parquet" -- "SELECT column1, COUNT(*) FROM table GROUP BY column1"
clickhouse://)cockroachdb://)cratedb://)duckdb://) - High-performance analyticsdynamodb://)h2://)jdbc:<subprotocol>:<database>) - JDBC drivers running in Ristrettomysql:// / mariadb://)postgresql:// / postgres://) - Including embedded PostgreSQLredshift://)scylladb://) - Including Scylla Cloud TLS and private Client Routessnowflake://)sqlserver://)sqlite:// / rusqlite://)arrow://) - In-memory columnar formatavro://) - Binary serialization formatcsv:// / tsv://) - Comma/tab-separated valuesexcel://) - .xlsx and .xls filesfwf://) - Fixed-width formatjson:// / jsonl://) - JSON documentsods://) - OpenDocument Spreadsheetorc://) - Optimized row columnar formatparquet://) - Columnar storage formatxml://) - XML documentsyaml://) - YAML documentsflightsql://) - Apache Arrow Flight SQLhttp:// / https://) - Remote filess3://) - Amazon S3 and S3-compatible storageAutomatically handles: Gzip, Brotli, Bzip2, LZ4, XZ, Zstd
# Connect to PostgreSQL
rsql --url "postgresql://user:pass@localhost/mydb"
# Use embedded PostgreSQL (no external setup required)
rsql --url "postgresql://?embedded=true"
# SQLite file
rsql --url "sqlite://database.db"
# ScyllaDB keyspace
rsql --url "scylladb://localhost:9042/my_keyspace"
# H2 in memory; downloads and caches the driver automatically
rsql --url "h2://" -- "SELECT H2VERSION();"
# H2 database persisted on disk
rsql --url "h2:./example"
# PostgreSQL through a JDBC driver resolved from Maven Central
rsql --url "jdbc:postgresql://localhost/example?user=postgres&dependency=org.postgresql:postgresql:42.7.13&driver=org.postgresql.Driver" -- "SELECT version();"
# Analyze CSV data
rsql --url "csv://sales.csv" -- "SELECT region, SUM(revenue) FROM table GROUP BY region"
# Query Excel spreadsheet
rsql --url "excel://report.xlsx" -- "SELECT * FROM table WHERE amount > 1000"
# Analyze Parquet files
rsql --url "parquet://logs.parquet" -- "SELECT date, COUNT(*) FROM table GROUP BY date"
# Convert CSV to JSON
rsql --url "csv://input.csv" --format json -- "SELECT * FROM input"
# Query compressed files
rsql --url "csv://data.csv.gz" -- "SELECT column1, column2 FROM data"
# Combine multiple formats
rsql --url "duckdb://" -- "
SELECT * FROM read_csv_auto('file1.csv')
UNION ALL
SELECT * FROM read_parquet('file2.parquet')
"
Control output with --format:
ascii - ASCII table (default)csv - Comma-separated valueshtml - HTML tablejson - JSON formatmarkdown - Markdown tablexml - XML formatyaml - YAML format# Set default format
rsql --url "sqlite://db.sqlite" --format json
# Custom delimiter for CSV output
rsql --url "postgresql://..." --format csv --delimiter ";"
# Expanded output for wide tables
rsql --url "..." --format expanded
CSV with custom options:
rsql --url "csv://data.csv?has_header=true&skip_rows=1"
Fixed-width file:
rsql --url "fwf://data.txt?widths=10,20,15&headers=id,name,email"
Delimited file with custom separator:
rsql --url "delimited://data.txt?separator=|&has_header=true"
PostgreSQL with SSL:
rsql --url "postgresql://user:pass@localhost/db?sslmode=require"
MySQL with charset:
rsql --url "mysql://user:pass@localhost/db?charset=utf8mb4"
| Feature | Description |
|---|---|
| Data Sources | Arrow, Avro, ClickHouse, CockroachDB, CrateDB, CSV, Delimited, DuckDB, DynamoDB, Excel, FlightSQL, FWF, H2, JDBC, JSON, JSONL, MariaDB, MySQL, ODS, ORC, Parquet, PostgreSQL, Redshift, ScyllaDB, Snowflake, SQLite3, SQL Server, TSV, XML, YAML |
| Compression | Brotli, Bzip2, Gzip, LZ4, XZ, Zstd |
| Syntax Highlighting | ✅ Full SQL syntax highlighting |
| Result Highlighting | ✅ Color output for better readability |
| Query Auto-completion | ✅ Smart completion for SQL keywords and table names |
| History | ✅ Command history with search |
| SQL File Execution | ✅ Execute .sql files directly |
| Embedded PostgreSQL | ✅ No external PostgreSQL installation required |
| 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
| Driver | URL |
|---|---|
| arrow (polars) | arrow://<file> |
| avro (polars) | avro://<file> |
| brotli¹ | brotli://<file> |
| bzip2¹ | bzip2://<file> |
| clickhouse | clickhouse://<user>[:<password>]@<host>[:<port>]/<database>[?access_token=<token>][&scheme=<http|https>] |
| cockroachdb (sqlx) | cockroachdb://<user>[:<password>]@<host>[:<port>]/<database> |
| cratedb (sqlx) | cratedb://<user>[:<password>]@<host>[:<port>]/<database> |
| csv (polars) | csv://<file>[?has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| delimited (polars) | delimited://<file>[?separator=<char>][&has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| duckdb | duckdb://[<file>] |
| dynamodb | dynamodb://[<access_key_id>:<secret_access_key>@]<host>[:<port>]>[?region=<region>][&session_token=<token>][&scheme=<http|https>] |
| excel | excel://<file>[?has_header=<true|false>][&skip_rows=<n>] |
| file¹ | file://<file> |
| flightsql | flightsql://<user[:password>]@<host>[:<port>][?scheme=<http|https>] |
| fwf | fwf://<file>?widths=<widths>[&headers=<headers>] |
| gzip¹ | gzip://<file> |
| h2 (JDBC) | h2:[<database>] |
| http¹ | http://<path>[?_headers=<headers>] |
| https¹ | https://<path>[?_headers=<headers>] |
| jdbc | jdbc:<subprotocol>:<database>[?classpath=<paths>&driver=<class>] |
| json (polars) | json://<file> |
| jsonl (polars) | jsonl://<file> |
| lz4¹ | lz4://<file> |
| mariadb (sqlx) | mariadb://<user>[:<password>]@<host>[:<port>]/<database> |
| mysql (sqlx) | mysql://<user>[:<password>]@<host>[:<port>]/<database> |
| ods | ods://<file>[?has_header=<true|false>][&skip_rows=<n>] |
| orc | orc://<file> |
| parquet (polars) | parquet://<file> |
| 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://[<file>] |
| s3¹ | s3://[<access_key_id>:<secret_access_key>@]<host>[:<port>]/<bucket>/<object>[?region=<region>][&session_token=<token>][&force_path_style=(true|false)][&scheme=<http|https>] |
| scylladb | scylladb://[<user>:<password>@]<host>[:<port>]/[<keyspace>][?node=<host>:<port>][&datacenter=<dc>][&sslmode=<disable|verify-full>][&ssl_ca=<pem-file>][&ssl_cert=<pem-file>&ssl_key=<pem-file>][&client_route=<connection-id>] |
| snowflake | snowflake://<user>[:<token>]@<account>.snowflakecomputing.com/[?private_key_file=pkey_file&public_key_file=pubkey_file] |
| sqlite (sqlx) | sqlite://[<file>] |
| sqlserver | sqlserver://[<user>[:<password>]@]<host>[:<port>][/<database>][?ApplicationName=<name>][&encrypt=(true|false|yes|no|DANGER_PLAINTEXT)][&TrustServerCertificate=(true|false|yes|no)][&TrustServerCertificateCA=<path>][&IntegratedSecurity=(true|false|yes|no)] |
| tsv (polars) | tsv://<file>[?has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| xml | xml://<file> |
| xz¹ | xz://<file> |
| yaml | yaml://<file> |
| zstd¹ | zstd://<file> |
¹ the driver will attempt to detect the type of file and automatically use the appropriate driver.
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.
Need help? Check out the documentation or open an issue on GitHub.
122 followers · starred Oct 2024
880 followers · starred Jul 2024
378 followers · starred Dec 2025
475 followers · starred Jul 2025
Command line SQL interface for relational databases and common data file formats
See the code
A modern, feature-rich command line SQL interface for data
rsql is a powerful and user-friendly command line SQL client that works with over 20 different
data sources and formats. Whether you're working with databases, files, or cloud services, rsql
provides a consistent and intuitive interface for all your data querying needs.
Linux / MacOS:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.sh | sh
or Homebrew:
brew install rsql
Windows:
irm https://github.com/theseus-rs/rsql/releases/latest/download/rsql_cli-installer.ps1 | iex
Cargo
cargo install rsql_cli
For detailed installation instructions, visit the rsql documentation.
Interactive Mode:
# Connect to a database
rsql --url "postgresql://user:pass@localhost/mydb"
# Query a CSV file
rsql --url "csv://data.csv"
# Use DuckDB for in-memory analytics
rsql --url "duckdb://"
Execute Single Query:
# Run a query and exit
rsql --url "sqlite://database.db" -- "SELECT * FROM users LIMIT 10"
# Query a Parquet file
rsql --url "parquet://data.parquet" -- "SELECT column1, COUNT(*) FROM table GROUP BY column1"
clickhouse://)cockroachdb://)cratedb://)duckdb://) - High-performance analyticsdynamodb://)h2://)jdbc:<subprotocol>:<database>) - JDBC drivers running in Ristrettomysql:// / mariadb://)postgresql:// / postgres://) - Including embedded PostgreSQLredshift://)scylladb://) - Including Scylla Cloud TLS and private Client Routessnowflake://)sqlserver://)sqlite:// / rusqlite://)arrow://) - In-memory columnar formatavro://) - Binary serialization formatcsv:// / tsv://) - Comma/tab-separated valuesexcel://) - .xlsx and .xls filesfwf://) - Fixed-width formatjson:// / jsonl://) - JSON documentsods://) - OpenDocument Spreadsheetorc://) - Optimized row columnar formatparquet://) - Columnar storage formatxml://) - XML documentsyaml://) - YAML documentsflightsql://) - Apache Arrow Flight SQLhttp:// / https://) - Remote filess3://) - Amazon S3 and S3-compatible storageAutomatically handles: Gzip, Brotli, Bzip2, LZ4, XZ, Zstd
# Connect to PostgreSQL
rsql --url "postgresql://user:pass@localhost/mydb"
# Use embedded PostgreSQL (no external setup required)
rsql --url "postgresql://?embedded=true"
# SQLite file
rsql --url "sqlite://database.db"
# ScyllaDB keyspace
rsql --url "scylladb://localhost:9042/my_keyspace"
# H2 in memory; downloads and caches the driver automatically
rsql --url "h2://" -- "SELECT H2VERSION();"
# H2 database persisted on disk
rsql --url "h2:./example"
# PostgreSQL through a JDBC driver resolved from Maven Central
rsql --url "jdbc:postgresql://localhost/example?user=postgres&dependency=org.postgresql:postgresql:42.7.13&driver=org.postgresql.Driver" -- "SELECT version();"
# Analyze CSV data
rsql --url "csv://sales.csv" -- "SELECT region, SUM(revenue) FROM table GROUP BY region"
# Query Excel spreadsheet
rsql --url "excel://report.xlsx" -- "SELECT * FROM table WHERE amount > 1000"
# Analyze Parquet files
rsql --url "parquet://logs.parquet" -- "SELECT date, COUNT(*) FROM table GROUP BY date"
# Convert CSV to JSON
rsql --url "csv://input.csv" --format json -- "SELECT * FROM input"
# Query compressed files
rsql --url "csv://data.csv.gz" -- "SELECT column1, column2 FROM data"
# Combine multiple formats
rsql --url "duckdb://" -- "
SELECT * FROM read_csv_auto('file1.csv')
UNION ALL
SELECT * FROM read_parquet('file2.parquet')
"
Control output with --format:
ascii - ASCII table (default)csv - Comma-separated valueshtml - HTML tablejson - JSON formatmarkdown - Markdown tablexml - XML formatyaml - YAML format# Set default format
rsql --url "sqlite://db.sqlite" --format json
# Custom delimiter for CSV output
rsql --url "postgresql://..." --format csv --delimiter ";"
# Expanded output for wide tables
rsql --url "..." --format expanded
CSV with custom options:
rsql --url "csv://data.csv?has_header=true&skip_rows=1"
Fixed-width file:
rsql --url "fwf://data.txt?widths=10,20,15&headers=id,name,email"
Delimited file with custom separator:
rsql --url "delimited://data.txt?separator=|&has_header=true"
PostgreSQL with SSL:
rsql --url "postgresql://user:pass@localhost/db?sslmode=require"
MySQL with charset:
rsql --url "mysql://user:pass@localhost/db?charset=utf8mb4"
| Feature | Description |
|---|---|
| Data Sources | Arrow, Avro, ClickHouse, CockroachDB, CrateDB, CSV, Delimited, DuckDB, DynamoDB, Excel, FlightSQL, FWF, H2, JDBC, JSON, JSONL, MariaDB, MySQL, ODS, ORC, Parquet, PostgreSQL, Redshift, ScyllaDB, Snowflake, SQLite3, SQL Server, TSV, XML, YAML |
| Compression | Brotli, Bzip2, Gzip, LZ4, XZ, Zstd |
| Syntax Highlighting | ✅ Full SQL syntax highlighting |
| Result Highlighting | ✅ Color output for better readability |
| Query Auto-completion | ✅ Smart completion for SQL keywords and table names |
| History | ✅ Command history with search |
| SQL File Execution | ✅ Execute .sql files directly |
| Embedded PostgreSQL | ✅ No external PostgreSQL installation required |
| 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
| Driver | URL |
|---|---|
| arrow (polars) | arrow://<file> |
| avro (polars) | avro://<file> |
| brotli¹ | brotli://<file> |
| bzip2¹ | bzip2://<file> |
| clickhouse | clickhouse://<user>[:<password>]@<host>[:<port>]/<database>[?access_token=<token>][&scheme=<http|https>] |
| cockroachdb (sqlx) | cockroachdb://<user>[:<password>]@<host>[:<port>]/<database> |
| cratedb (sqlx) | cratedb://<user>[:<password>]@<host>[:<port>]/<database> |
| csv (polars) | csv://<file>[?has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| delimited (polars) | delimited://<file>[?separator=<char>][&has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| duckdb | duckdb://[<file>] |
| dynamodb | dynamodb://[<access_key_id>:<secret_access_key>@]<host>[:<port>]>[?region=<region>][&session_token=<token>][&scheme=<http|https>] |
| excel | excel://<file>[?has_header=<true|false>][&skip_rows=<n>] |
| file¹ | file://<file> |
| flightsql | flightsql://<user[:password>]@<host>[:<port>][?scheme=<http|https>] |
| fwf | fwf://<file>?widths=<widths>[&headers=<headers>] |
| gzip¹ | gzip://<file> |
| h2 (JDBC) | h2:[<database>] |
| http¹ | http://<path>[?_headers=<headers>] |
| https¹ | https://<path>[?_headers=<headers>] |
| jdbc | jdbc:<subprotocol>:<database>[?classpath=<paths>&driver=<class>] |
| json (polars) | json://<file> |
| jsonl (polars) | jsonl://<file> |
| lz4¹ | lz4://<file> |
| mariadb (sqlx) | mariadb://<user>[:<password>]@<host>[:<port>]/<database> |
| mysql (sqlx) | mysql://<user>[:<password>]@<host>[:<port>]/<database> |
| ods | ods://<file>[?has_header=<true|false>][&skip_rows=<n>] |
| orc | orc://<file> |
| parquet (polars) | parquet://<file> |
| 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://[<file>] |
| s3¹ | s3://[<access_key_id>:<secret_access_key>@]<host>[:<port>]/<bucket>/<object>[?region=<region>][&session_token=<token>][&force_path_style=(true|false)][&scheme=<http|https>] |
| scylladb | scylladb://[<user>:<password>@]<host>[:<port>]/[<keyspace>][?node=<host>:<port>][&datacenter=<dc>][&sslmode=<disable|verify-full>][&ssl_ca=<pem-file>][&ssl_cert=<pem-file>&ssl_key=<pem-file>][&client_route=<connection-id>] |
| snowflake | snowflake://<user>[:<token>]@<account>.snowflakecomputing.com/[?private_key_file=pkey_file&public_key_file=pubkey_file] |
| sqlite (sqlx) | sqlite://[<file>] |
| sqlserver | sqlserver://[<user>[:<password>]@]<host>[:<port>][/<database>][?ApplicationName=<name>][&encrypt=(true|false|yes|no|DANGER_PLAINTEXT)][&TrustServerCertificate=(true|false|yes|no)][&TrustServerCertificateCA=<path>][&IntegratedSecurity=(true|false|yes|no)] |
| tsv (polars) | tsv://<file>[?has_header=<true|false>]["e=<char>][&skip_rows=<n>] |
| xml | xml://<file> |
| xz¹ | xz://<file> |
| yaml | yaml://<file> |
| zstd¹ | zstd://<file> |
¹ the driver will attempt to detect the type of file and automatically use the appropriate driver.
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.
Need help? Check out the documentation or open an issue on GitHub.
122 followers · starred Oct 2024
880 followers · starred Jul 2024
378 followers · starred Dec 2025
475 followers · starred Jul 2025