querypie 0.1.0

Query QueryPie databases from the terminal with webview authentication.
docs.rs failed to build querypie-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

querypie-cli

license release crates.io built with rust

Query QueryPie databases from the terminal with webview authentication.

Quick Start

querypie --host querypie.example.com auth login
querypie --host querypie.example.com connection list
querypie --host querypie.example.com -c '<connection>' --engine mysql query 'select 1;'

Installation

cargo install querypie

Or download a binary from GitHub Releases.

Build from source:

cargo build --release

Linux builds require the WebKitGTK and Tauri system packages used by the CI workflow.

Commands

Command Purpose
auth login Open the QueryPie WebView login
auth status Show login status
auth logout Clear the WebView profile for a host
connection list List available QueryPie connections
database list List databases for a connection
schema list List schemas for a database
table list List tables
table describe <table> Show QueryPie table structure
table ddl <table> Show QueryPie table DDL
query <sql> Run SQL through QueryPie
session list List cached database sessions
session clear Clear cached database sessions

Examples

querypie --host querypie.example.com connection list
querypie --host querypie.example.com -c '<connection>' --engine mysql database list
querypie --host querypie.example.com -c '<connection>' --engine mysql --db example_db table list
querypie --host querypie.example.com -c '<connection>' --engine mysql --db example_db table describe users
querypie --host querypie.example.com -c '<connection>' --engine mysql --db example_db query 'select 1;'

Use --output json for machine-readable output.

querypie --host querypie.example.com connection list --output json

Authentication

  • Login uses a dedicated Tauri WebView.
  • httpOnly QueryPie cookies stay in the WebView cookie store.
  • Access token refresh runs automatically in the background.
  • If refresh fails or no login exists, commands exit with an auth error.
  • Commands do not open a login window automatically.

Configuration

Default path:

~/.config/querypie/config.json

Example:

{
  "host": "querypie.example.com",
  "connection": "example-main",
  "database": "example_db"
}

CLI flags override config values.

Output

  • --output text: default human-readable output
  • --output json: raw JSON output
  • --no-truncate: do not shorten long table cells
  • QUERYPIE_NO_TRUNCATE=1: disable truncation globally

NULL values are rendered distinctly in text output.

How It Works

  1. auth login opens QueryPie in a Tauri WebView.
  2. The CLI reads httpOnly cookies through the same WebView profile.
  3. API calls use QueryPie's gRPC-Web endpoints.
  4. Expired access tokens are refreshed through the WebView cookie store.
  5. Database sessions are cached under ~/.cache/querypie.

Troubleshooting

Check auth:

querypie --host querypie.example.com auth status

Clear cached database sessions:

querypie --host querypie.example.com session clear

Development

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo build --all-features

License

MIT