Skip to content

fix: remove hardcoded 10-row limit from query output, add -n flag - #50

Closed
codeasier wants to merge 2 commits into
mainfrom
fix/query-output-truncation
Closed

codeasier wants to merge 2 commits into
mainfrom
fix/query-output-truncation

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

pt-snap query output was hardcoded to display only the first 10 results (results[:10]), making it impossible to retrieve full query results. This change:

  • Removes the hardcoded 10-row truncation; default behavior now displays all results
  • Adds -n flag to optionally limit displayed rows (e.g. pt-snap query -n 5)
  • -n <= 0 means unlimited (same as not specifying it)
  • Header message shows total vs displayed count, with a hint to use -n when truncated

🔗 Related Issue

Fixes #49

🧪 Testing

  • Tests added/updated (no existing tests cover the CLI output display logic)
  • Manual testing completed
  • Lint checks passed (ruff check ., black --check .)
  • Existing tests passed (225/226; 1 pre-existing unrelated failure in test_completion.py)

✅ Checklist

  • Code follows project guidelines
  • Documentation updated (if applicable)
  • No new warnings introduced
  • Changes tested locally

📸 Screenshots (if applicable)

Before (hardcoded 10-row limit):

Found 50 results:
  {...}
  ...
  ... and 40 more

After (default unlimited):

Found 50 results, showing 50:
  {...}
  ...
  {...}

With -n 5:

Found 50 results, showing 5:
  {...}
  ...
  ... and 45 more (use -n to show more)

📋 Additional Notes

No database or test fixture was modified — only cli.py display logic changed.

codeasier added 2 commits April 18, 2026 22:51
Stop tracking these files in git while keeping them locally. These are
tool-specific/local configuration files that should not be version controlled.

Refs #47
Query results were always truncated to first 10 rows with no way to
retrieve the full list. Change default to unlimited output and add a
-n flag to optionally limit displayed rows.

Fixes #49
@codeasier codeasier closed this Apr 18, 2026
@codeasier
codeasier deleted the fix/query-output-truncation branch April 18, 2026 15:18
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.

[BUG] Query output truncated to first 10 rows, no option to display full results

1 participant