2 unstable releases
Uses new Rust 2024
| new 0.2.0 | Feb 15, 2026 |
|---|---|
| 0.1.1 | Feb 5, 2026 |
#111 in Value formatting
Used in 4 crates
395KB
9K
SLoC
SQLModel Console - Beautiful terminal output for SQLModel Rust.
sqlmodel-console is the optional UX layer for SQLModel Rust. It renders
errors, query results, schema trees, and progress in a way that adapts to
humans (rich formatting) or agents/CI (plain or JSON).
Role In The Architecture
- Optional integration: enabled via the
consolefeature insqlmodelor in driver crates. - Agent-safe output: auto-detects AI coding tools and switches to plain text.
- Diagnostics: provides structured renderables for tables, errors, and status.
This crate provides styled console output that automatically adapts to the terminal environment. When running under an AI coding agent, output is plain text. When running interactively, output is richly formatted.
Features
rich- Enable rich formatted output with colors, tables, panelssyntax- Enable SQL syntax highlighting (requiresrich)full- Enable all features
Output Mode Detection
The crate automatically detects the appropriate output mode:
- Plain: AI agents (Claude Code, Codex, etc.), CI systems, piped output
- Rich: Interactive human terminal sessions
- Json: Structured output for tool integrations
You can override detection via environment variables:
SQLMODEL_PLAIN=1- Force plain text outputSQLMODEL_RICH=1- Force rich output (even for agents)SQLMODEL_JSON=1- Force JSON structured output
Example
use sqlmodel_console::OutputMode;
let mode = OutputMode::detect();
if mode.supports_ansi() {
println!("Rich formatting available!");
} else {
println!("Plain text mode");
}
sqlmodel-console
Optional rich console output for SQLModel Rust.
Role in the SQLModel Rust System
- Renders errors, tables, and schema visuals with rich formatting.
- Auto-detects AI agents/CI and falls back to plain/JSON output.
- Enabled via the
consolefeature in sqlmodel or driver crates.
Usage
Most users should depend on sqlmodel and import from sqlmodel::prelude::*.
Use this crate directly if you are extending internals or building tooling around the core APIs.
Links
- Repository: https://github.com/sqlmodel/sqlmodel-rust
- Documentation: https://docs.rs/sqlmodel-console
Dependencies
~0.5–7.5MB
~159K SLoC