Database Query Processor

February 21, 2026 ยท View on GitHub

File: src/processors/db_query.py | Priority: 38 | Name: db_query

Handles database query result output.

Supported Commands

psql, mysql, sqlite3, mycli, pgcli, litecli.

Strategy

FormatStrategy
PostgreSQL table (| separators, (N rows) footer)Keeps header + first 11 and last 10 data rows. Preserves row count footer
MySQL table (+---+ borders)Keeps header + first 11 and last 10 data rows. Preserves row count footer
CSV/TSV outputKeeps header + first 10 and last 5 data rows. Shows column count
Generic tabularKeeps first 15 and last 5 lines

What is preserved

  • Table headers (column names)
  • First and last data rows (for context)
  • Row count footers ((N rows), N rows in set)
  • Error messages
  • Query timing information

What is removed

  • Middle data rows when result set exceeds threshold
  • Decorative separator lines within data

Configuration

ParameterDefaultDescription
db_max_rows20Maximum data rows shown before truncation