Skip to content

feat: add --verbose and --skip-partitions flags for doc/out commands#802

Open
patkujawa-wf wants to merge 2 commits intok1LoW:mainfrom
patkujawa-wf:postgres_partitions_and_verbose
Open

feat: add --verbose and --skip-partitions flags for doc/out commands#802
patkujawa-wf wants to merge 2 commits intok1LoW:mainfrom
patkujawa-wf:postgres_partitions_and_verbose

Conversation

@patkujawa-wf
Copy link
Copy Markdown

@patkujawa-wf patkujawa-wf commented Feb 3, 2026

NOTE: I used Claude Code for these changes.

If this is desirable, I'm happy to split out the --skip-partitions changes and the --verbose changes into two PRs (or drop the verbose one if not desired).

Summary

  • Add --verbose/-v flag to show progress with elapsed timestamps during database analysis
  • Add --skip-partitions flag to skip PostgreSQL table partitions (useful for databases with many partitions)
  • Skip relations referencing excluded partition tables when --skip-partitions is enabled
  • Mask passwords in DSN URLs when verbose logging is enabled
  • Add verbose logging throughout datasource connection and postgres driver to help diagnose slow operations

Motivation

When running tbls doc against a PostgreSQL database through a proxy (e.g., Aurora), the command can appear to hang with no feedback. These changes help users:

  1. See real-time progress to identify where time is spent
  2. Skip partition tables that can significantly slow down analysis (each partition requires separate queries for columns, indexes, constraints, etc.)

Example output

[   0.00s] Starting tbls doc
[   0.00s] Loading configuration
[   0.00s] Configuration loaded (DSN: postgres://user:****@host:5432/db)
[   0.00s] Analyzing database schema
[   0.00s] Opening database connection
[   5.32s] Pinging database
[  10.45s] Database connection established
[  10.45s] Running driver analysis for postgres
[  10.46s] Fetching database version info
[  10.52s] Querying tables
[  10.53s] Skipping table partitions
[  12.30s] Processing table: public.users (BASE TABLE)
...

Test plan

  • Verified --verbose shows progress with SQLite test database
  • Verified --skip-partitions excludes partition tables
  • Verified password masking in verbose output
  • Verified tbls out command also supports both flags
  • Tested against real Aurora PostgreSQL with partitioned tables

- Add --verbose/-v flag to show progress with elapsed timestamps
- Add --skip-partitions flag to skip PostgreSQL table partitions
- Skip relations referencing excluded partition tables
- Mask passwords in DSN when verbose logging
- Add verbose logging to datasource connection and postgres driver

These flags help diagnose slow database analysis (especially with
partitioned tables) and reduce unnecessary partition scanning.
@patkujawa-wf patkujawa-wf marked this pull request as draft February 3, 2026 17:22
Comment on lines +728 to +743
SELECT
cls.oid AS oid,
cls.relname AS table_name,
CASE
WHEN cls.relkind IN ('r', 'p') THEN 'BASE TABLE'
WHEN cls.relkind = 'v' THEN 'VIEW'
WHEN cls.relkind = 'm' THEN 'MATERIALIZED VIEW'
WHEN cls.relkind = 'f' THEN 'FOREIGN TABLE'
END AS table_type,
ns.nspname AS table_schema,
descr.description AS table_comment
FROM pg_class AS cls
INNER JOIN pg_namespace AS ns ON cls.relnamespace = ns.oid
LEFT JOIN pg_description AS descr ON cls.oid = descr.objoid AND descr.objsubid = 0
WHERE ns.nspname NOT IN ('pg_catalog', 'information_schema')
AND cls.relkind IN ('r', 'p', 'v', 'f', 'm')`
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is straight copy, with ORDER BY oid added later

@patkujawa-wf patkujawa-wf marked this pull request as ready for review February 23, 2026 17:48
@celsobenedetti
Copy link
Copy Markdown

--verbose would be awesome

@k1LoW
Copy link
Copy Markdown
Owner

k1LoW commented Mar 23, 2026

Thanks for the proposal.

We are not planning to add these features at this stage. Both introduce significant complexity that needs careful vetting. Also, to keep the codebase maintainable, we want to avoid overly complex PRs that bundle multiple high-impact changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants