Repository navigation
fix(reflection): do not translate native -493 syntax errors into NoSuchTableError - #455
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues remain in error-message matching and legacy driver handling.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Fixes reflection error handling so native -493 syntax errors are not misreported as missing tables.
Changes:
- Refines missing-table detection.
- Adds regression tests for reflection errors.
- Updates the changelog.
| File | Description |
|---|---|
test/test_dialect_offline.py |
Adds syntax and missing-table regression tests. |
sqlalchemy_cubrid/dialect.py |
Updates missing-table error classification. |
CHANGELOG.md |
Documents the reflection fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks a lot for tackling #454, @UsmanGhias. The predicate change is the right direction, and the new tests cover the pycubrid, wrapped and tuple-arg shapes well (they fail on
After you push, CI will re-run against current |
4cf28ec to
474c0db
Compare
|
Thanks for the thorough review, @yeongseon. I have addressed all the review items:
All lint, format, typecheck, and offline tests pass locally. Regards, |
|
Thanks for the quick and thorough update, @UsmanGhias. Formatting, the Before merging I checked the predicate against a live server, and found something neither of us caught from the mocks. pycubrid currently reports every native -493 as
The one signal that's reliable on both servers and both drivers is the server's own
Missing-table reflection keeps working with that rule: both SHOW statements above carry |
6dce527 to
0895c39
Compare
|
@codex review |
0895c39 to
c8584ea
Compare
… in get_columns/get_indexes (#454) get_columns() and get_indexes() still used _is_no_such_table_error(), which treated native -493, SQLSTATE 42S02 or a "Table not found" message as a missing table. CUBRID uses -493 for every parser error, so a syntax error (for example a table name containing "]") became NoSuchTableError. Use _is_unknown_class_error() there, as the other reflection methods do since Rebased and narrowed by the maintainer onto current main from the original PR by @UsmanGhias. Co-authored-by: Usman Ghias <iusmanghias@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CUBRID 10.2 accepts "]" in a quoted identifier and reports Unknown class, so the name only produces a -493 syntax error on 11.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c8584ea to
b0d051d
Compare
yeongseon
left a comment
There was a problem hiding this comment.
Since the last round, #530 on main added _is_unknown_class_error() (the Unknown class-only rule from my previous comment) and moved most reflection call sites to it. Only get_columns() and get_indexes() still used the loose _is_no_such_table_error(), so as maintainer I narrowed this PR to those two sites and rebased it onto the 1.8.0 main:
- Both methods now use
_is_unknown_class_error(), and_is_no_such_table_error()with its errno/SQLSTATE constants is removed. - Offline tests: your predicate cases are kept but model the real pycubrid shape (
errno=-493,sqlstate='42S02',description='Table not found', noUnknown class→ not missing). A parametrizedget_columns/get_indexestest checks that a syntax error propagates unchanged. The existingget_indexesmissing-table test now uses the realUnknown classmessage. - A live test in
test/test_integration.pychecks that a missing table still raisesNoSuchTableErrorand that a -493 syntax error (a name containing], rejected by CUBRID 11.4) propagates as the driver error. It fails onmainand passes here. CUBRID 10.2 accepts]in a quoted name, so that half runs on 11.4+ only. - EN/KO troubleshooting note and
llms-full.txtupdated, and the CHANGELOG entry is under[Unreleased]→### Fixed.
Verified with pycubrid 1.8.0 on CUBRID 10.2 and 11.4 (full test_integration.py), the full offline suite, and green CI. Approving.
|
Merged as a581fa7. Thank you @UsmanGhias! You found and pinned down #454, and your tests and troubleshooting note are what this change builds on. |
|
Welcome @yeongseon 🙌🏻 |


Resolves #454.
Problem
In
sqlalchemy_cubrid/dialect.py,_is_no_such_table_error()returnedTrueimmediately wheneverorig.errno == -493.In CUBRID, native code
-493representsER_PT_SYNTAX(general parser syntax error), not a dedicated table-not-found error code. When a syntax error occurs duringget_columns()orget_indexes()(e.g.ProgrammingError("Syntax error: unexpected 'SELEC'", errno=-493, sqlstate="42000")), the error boundary mistakenly converted theProgrammingErrorintoNoSuchTableError, hiding failed metadata queries.Solution
errno == -493evaluation from_is_no_such_table_error().42S02(base table or view not found), or'Unknown class'or'Table not found') across both pycubrid and CUBRIDdb error shapes (including tuple args).NoSuchTableErrortranslation for genuine missing tables across both drivers.SQLSTATE 42000) now correctly propagate their original exceptions rather than being masked as missing tables.test/test_dialect_offline.pycovering:-493.42S02,Unknown classmessages, and tuple args.get_columns()andget_indexes().Fixed.Verification
Ran test suite locally:
All 143 tests passed.