How rioliu/dbq works
dbq is a multi-database CLI and bundled agent skill: users manage credential profiles, discover schemas, test connections, and run bounded SQL queries to receive table, JSON, or CSV results. The runtime path is CLI dispatch, profile resolution, statement and engine-level safeguards, database execution, then result formatting. Profile creation, editing, and removal are distinct workflows. The graph also preserves the documented agent-skill integration and five supported database engines. Several source excerpts are partial; links to unsampled behavior rely on README documentation rather than inferred calls.
Main entry points: query.go Query and schema execution · main.go Command dispatch · profile.go Load profiles · profile_add.go Add profile
Components 21
CLI workflows
- Command dispatch
main.go - Profile commands
main.go - Schema command
main.go - Ping command
main.go - Query command
main.go
Profile management
- Load profiles
internal/dbq/profile.go - Add profile
internal/dbq/profile_add.go - Edit profile
internal/dbq/profile_edit.go - Remove profile
internal/dbq/profile_remove.go - Profile file
Query execution
- Statement guard
internal/dbq/guard.go - Query and schema execution
internal/dbq/query.go - Engine read-only mode
internal/dbq/query.go - Result formatting
internal/dbq/output.go
Database and agent integrations
- MySQL
- PostgreSQL
- SQL Server
- Oracle
- SQLite
- dbq agent skill
skills/dbq/SKILL.md
Other components
- User or agent
Connections 31
- User or agent → Command dispatch: runs commands
README.md - Command dispatch → Profile commands: dispatches profile actions
main.go - Command dispatch → Schema command: dispatches schema
main.go - Command dispatch → Ping command: dispatches ping
main.go - Command dispatch → Query command: dispatches query
main.go - Profile commands → Add profile: adds profiles
README.md - Profile commands → Edit profile: edits profiles
README.md - Profile commands → Remove profile: removes profiles
README.md - Add profile → Profile file: appends securely
internal/dbq/profile_add.go - Edit profile → Profile file: updates securely
internal/dbq/profile_edit.go - Remove profile → Profile file: removes securely
internal/dbq/profile_remove.go - Load profiles → Profile file: reads profiles
internal/dbq/profile.go - Query command → Load profiles: resolves profile
README.md - Ping command → Load profiles: resolves profile
README.md - Schema command → Load profiles: resolves profile
README.md - Query command → Statement guard: validates statement
- Query command → Query and schema execution: runs query
main.go - Schema command → Query and schema execution: lists schema
README.md - Ping command → Query and schema execution: tests connection
main.go - Query and schema execution → Engine read-only mode: enables read-only
internal/dbq/query.go - Query command → Result formatting: formats results
README.md - Query and schema execution → MySQL: queries
README.md - Query and schema execution → PostgreSQL: queries
README.md - Query and schema execution → SQL Server: queries
README.md - Query and schema execution → Oracle: queries
README.md - Query and schema execution → SQLite: queries
README.md - Engine read-only mode → MySQL: sets read-only
README.md - Engine read-only mode → PostgreSQL: sets read-only
README.md - Engine read-only mode → Oracle: sets read-only
README.md - Engine read-only mode → SQLite: sets read-only
README.md - User or agent → dbq agent skill: uses guidance
README.md