Skip to content

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

Merged
codeasier merged 1 commit into
mainfrom
fix/query-output-truncation
Apr 18, 2026
Merged

codeasier merged 1 commit 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
  • 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

Files changed:

  • src/pt_snap_cli/cli.py — display logic
  • docs/en/querying.md — output format documentation
  • docs/zh/querying.md — output format documentation (Chinese)

@codeasier
codeasier force-pushed the fix/query-output-truncation branch 2 times, most recently from 9d30243 to 27213dd Compare April 18, 2026 15:21
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 force-pushed the fix/query-output-truncation branch from 27213dd to d414ade Compare April 18, 2026 15:30
@codeasier
codeasier merged commit b4b5ebe into main Apr 18, 2026
5 checks passed
@codeasier
codeasier deleted the fix/query-output-truncation branch April 18, 2026 15:31
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