You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: preserve literal percent signs in hybrid search - #305
Pass None to PyMySQL when there are no bind arguments, in both cursor lifecycles. This preserves literal percent signs in complete SQL while leaving non-empty argument binding unchanged.
Add driver-level coverage for literal percent signs and percent signs inside bound values. Add a full-text-only hybrid search regression that checks the actual document hit without relying on a vector route.
Validation
On the original code, the two unbound cursor cases and the embedded hybrid search regression reproduced the reported formatting error; the two bound-value controls passed.
After the fix, 17 tests passed across the cursor tests, hybrid SQL rewrite tests, and embedded hybrid search suite (macOS arm64, Python 3.12, PyMySQL 1.1.2, pylibseekdb 1.4.1.post2). Server and OceanBase variants were not run locally.
Ruff check, Ruff format check, and git diff --check passed.
No actionable comments were generated in the recent review.
Walkthrough
Cursor execution now passes None when parameters are empty, in both cursor-management paths. Regression tests cover percent signs in SQL and bound values, plus full-text hybrid search for a document containing a percent sign.
Changes: Cursor percent handling
Layer / File(s)
Summary
Normalize empty parameters and validate percent handling src/pyseekdb/client/client_base.py, tests/unit_tests/test_cursor_execution.py, tests/integration_tests/test_collection_hybrid_search.py
Both cursor paths pass None for empty parameters and preserve nonempty parameters. Unit tests cover percent signs in SQL and bound values. An integration test covers hybrid search for a document containing a percent sign.
This change stops literal percent signs in hybrid search from raising a formatting error when no bind parameters are present. Binding with parameters is unchanged. No merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix: preserve literal percent signs in hybrid search" matches the main change. The PR passes None to cursor execution when there are no bind parameters, so literal % characters in complete …
Linked Issues check
[#304] The issue requires that the embedded hybrid_search path stop applying Python %-formatting to SQL when no bind parameters exist, and keep binding when parameters exist. The whole-PR summary stat…
Out of Scope Changes check
All changes in the PR relate to #304. The production change is limited to _execute_query_with_cursor in src/pyseekdb/client/client_base.py (+5/-3 per the summary), which is the helper named in the iss…
Full details: Title check
Explanation
The title "fix: preserve literal percent signs in hybrid search" matches the main change. The PR passes None to cursor execution when there are no bind parameters, so literal % characters in complete SQL are not formatted by PyMySQL. The title names the bug (literal percent signs) and the affected feature (hybrid search), which matches the linked issue #304 and the changed client_base.py code. It is concise, has no file list or vague wording, and follows a conventional commit prefix.
Full details: Linked Issues check
Explanation
[#304] The issue requires that the embedded hybrid_search path stop applying Python %-formatting to SQL when no bind parameters exist, and keep binding when parameters exist. The whole-PR summary states that BaseClient._execute_query_with_cursor now passes None to cursor execution when params is empty, in both cursor-management paths, and passes non-empty lists unchanged. The issue states that both set_sql (client_base.py line ~4729) and query_sql (line ~4767) go through this helper with [], so the change covers both statements. The added unit tests in tests/unit_tests/test_cursor_execution.py assert that literal '%' in SQL with [] reaches Cursor._query unchanged (with and without context manager), and that '%s' with ['record%123'] still binds correctly. The added integration test test_hybrid_search_full_text_with_percent in tests/integration_tests/test_collection_hybrid_search.py covers the full-text-only regression with '5%'. Limits: the source diff for client_base.py could not be read (changed blobs missing from checkout), so the code change is established from the PR summary and the test file at head, not from the diff itself. Tests were not run in this review. The optional parameterization of the SET @search_parm statement is not required by the issue.
Full details: Out of Scope Changes check
Explanation
All changes in the PR relate to #304. The production change is limited to _execute_query_with_cursor in src/pyseekdb/client/client_base.py (+5/-3 per the summary), which is the helper named in the issue. The unit test file and the integration test are regression tests for the same formatting failure. No unrelated source, API, or declaration changes are reported (the summary lists no public declaration changes). The source diff could not be read directly, so this verdict relies on the PR summary and the test file contents.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Pylint (4.1.3)
Pylint used default settings because repository settings are unavailable in automated reviews.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Noneto PyMySQL when there are no bind arguments, in both cursor lifecycles. This preserves literal percent signs in complete SQL while leaving non-empty argument binding unchanged.Validation
git diff --checkpassed.Closes #304.
Summary by CodeRabbit