Skip to content

refactor(mssql): strip trailing semicolon on unlimited query path for connector consistency - #2633

Open
Bartok9 wants to merge 1 commit into
Canner:mainfrom
Bartok9:fix/mssql-strip-semicolon-unlimited
Open

refactor(mssql): strip trailing semicolon on unlimited query path for connector consistency#2633
Bartok9 wants to merge 1 commit into
Canner:mainfrom
Bartok9:fix/mssql-strip-semicolon-unlimited

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Strip trailing semicolons on the MSSQL unlimited _raw_cursor_sql path so it matches dry_run / limited composition and sibling connectors (e.g. #2595 MySQL).

Context (replaces closed #2566)

@goldmedal correctly challenged #2566: that PR reversed a deliberate "execute path allows it" test without a pyodbc failure case, and a lone trailing ; is accepted by pyodbc. Agreed.

This PR is the same code change re-framed honestly as a consistency refactor (title + body + test comments), rebased onto current main.

What changed since the "allows it" test

Verification

./.venv/bin/python -m pytest tests/unit/test_mssql_semicolon.py -v
3 passed

@goldmedal ready for review when convenient — thank you again for the careful catch on framing.

Summary by CodeRabbit

  • Bug Fixes
    • Improved MSSQL query handling by consistently removing trailing semicolons from SQL statements.
    • Supports statements ending with one or multiple semicolons.

Align unlimited `_raw_cursor_sql` with dry_run/limit composition and
sibling connectors (Canner#2595). Not claimed as a pyodbc lone-terminator
failure — consistency only.

Signed-off-by: Bartok9 <danielrpike9@gmail.com>
@github-actions github-actions Bot added python Pull requests that update Python code core labels Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ca88612-dd30-43dc-80b8-bc78928c89c4

📥 Commits

Reviewing files that changed from the base of the PR and between 4cd4bf8 and 96a04e2.

📒 Files selected for processing (2)
  • core/wren/src/wren/connector/mssql.py
  • core/wren/tests/unit/test_mssql_semicolon.py

Walkthrough

The MSSQL connector now strips trailing semicolons for unlimited SQL. The unit test verifies removal for SQL with one or multiple trailing semicolons.

Changes

MSSQL semicolon normalization

Layer / File(s) Summary
Normalize unlimited SQL and validate semicolon removal
core/wren/src/wren/connector/mssql.py, core/wren/tests/unit/test_mssql_semicolon.py
_raw_cursor_sql strips trailing semicolons before the unlimited-return path. Tests cover single and multiple trailing semicolons.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

Possibly related PRs

  • Canner/WrenAI#2566 — Directly modifies the same MSSQL method and semicolon-handling tests.
  • Canner/WrenAI#2595 — Applies similar unlimited-query semicolon normalization in another connector.
  • Canner/WrenAI#2476 — Introduces the related MSSQL semicolon-stripping behavior and tests.

Suggested reviewers: goldmedal

Poem

A rabbit checked the query line,
One semicolon, then two, now fine.
MSSQL trims the trailing mark,
Tests now guard the cleaner path.
Hop, hop—consistent SQL shines!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the MSSQL unlimited-query refactor and the trailing-semicolon behavior change.
Description check ✅ Passed The description explains the consistency refactor, testing, and non-bug framing; the duplicate-check section is only partially explicit.
Linked Issues check ✅ Passed The changes implement the linked issue by stripping trailing semicolons on the MSSQL unlimited path and updating the related test.
Out of Scope Changes check ✅ Passed All changes are limited to the MSSQL SQL normalization behavior and its focused unit test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Bartok9

Bartok9 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@goldmedal — redesigned follow-up to closed #2566 after your review:

Please re-review when your queue allows. Thanks again for pushing for the honest framing.

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

Labels

core python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant