polite-cli

Crates.iopolite-cli
lib.rspolite-cli
version0.1.3
created_at2025-08-25 21:01:01.888814+00
updated_at2025-08-26 21:50:33.055314+00
descriptionCommand-line interface for rusqlite × Polars integration
homepagehttps://github.com/lmmx/polite
repositoryhttps://github.com/lmmx/polite
max_upload_size
id1810146
size86,551
Louis Maddox (lmmx)

documentation

https://docs.rs/polite-cli/

README

polite-cli

crates.io MIT licensed

A command-line interface for polite, the rusqlite × Polars bridge library.

Installation

cargo install polite-cli

Usage

The CLI takes:

polite "<SQL>" <DB_PATH>

and automatically decides:

  • If the SQL starts with SELECT → runs it and prints a Polars DataFrame.
  • Otherwise → executes the statement and prints rows affected.

⚠️ Important: ConnectorX (used internally for DataFrame reads) requires a file-backed database. You must provide a database file path (e.g. mydb.sqlite). In-memory databases (:memory:) are not supported.

Create a table

polite "CREATE TABLE t (id INTEGER, name TEXT)" mydb.sqlite

Insert a row

polite "INSERT INTO t VALUES (1, 'Alice')" mydb.sqlite

Query into a DataFrame

polite "SELECT * FROM t" mydb.sqlite

Example

polite "CREATE TABLE users (id INTEGER, name TEXT)" example.sqlite
polite "INSERT INTO users VALUES (1, 'Bob')" example.sqlite
polite "SELECT * FROM users" example.sqlite

Notes

  • File-backed SQLite databases only. ConnectorX cannot read from in-memory databases.
  • Temporary files (tempfile) are a good option if you don’t want the DB to persist.

Documentation

License

Licensed under the MIT License. See LICENSE for details.

Commit count: 31

cargo fmt