Skip to content

Route Prism errors to PEP 249 subclasses in Python 2.2.0 - #6

Merged
vogti merged 7 commits into
masterfrom
codex/pep249-error-routing
Nov 23, 2026
Merged

vogti merged 7 commits into
masterfrom
codex/pep249-error-routing

Conversation

@vogti

@vogti vogti commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Changes

  • Route structured Prism SQLSTATE classes through the PEP 249 hierarchy. Preserve the server message verbatim and expose optional sqlstate and errorcode on picklable exceptions, including code 0. Message-only responses and unknown classes use DatabaseError.
  • Preserve the exception imports from polypheny.connection. Classify cursor misuse, lost connections, protocol mismatches, and unsupported values through their DB-API exceptions.
  • Release failed statements, clear failed or undecodable paged results, and reject mismatched statement IDs before exposing a result to the cursor. Add targeted wire regressions.
  • Preserve the test server's existing runtime constraint settings in S10 and S12. Restore changed settings through the Web UI config service when the original Prism connection fails. Document the test Web UI setting for servers on alternate ports.
  • Keep the connector release target at 2.2.0.

Verification

  • On Linux with Python 3.12 and the combined DB pin c548758eaa8aa55c936656eb6c09fdaefb537517, the latest fixture follow-up passed all 196 pytest cases on each of HSQLDB and File. The preceding driver revision passed all 193 cases and five Sphinx doctests on each of HSQLDB, File, Neo4j, and MongoDB. These suites include S1–S15.
  • On real Neo4j and MongoDB, S7 returned DataError with 22018, S8 returned DataError with 22012, and the same cursor successfully queried after rollback. Neo4j retained its historical diagnostics. MongoDB supplied the SQL evaluator's diagnostics. Python exposed the exact text received from Prism in each case.
  • Isolated live S10 and S12 tests preserved both initially enabled and initially disabled server settings. Injected acknowledgement loss and transport failure on HSQLDB confirmed independent restoration and preservation of the original error. Three DB-free regressions cover cleanup after a lost ALTER reply, failed rollback, and rejected HTTP restoration. Wire-level tests cover statement ID mismatches and paged results with an unsupported ProtoFile ahead of a buffered row.
  • A live Prism 2.3 server returned exact DatabaseError for statement and login failures, preserved the original text, and exposed both metadata attributes as None. The connection remained usable after rollback.
  • Built the 2.2.0 wheel and sdist locally, verified them with Twine, and resolved the official Prism 2.4 dependency in a clean installation. pip check and the error pickle round trip passed.

Dependencies and CI

  • Structured server details require Polypheny-DB #586 and the official Prism 2.4 release. The Python bindings are available on PyPI, and the server schema is available on Maven Central.
  • The main test workflow checks out Polypheny-DB master by default and honors POLYPHENY_DB_REF when set. At the switch, master resolved to merge commit b6182725e89160f320d69838015155c19768dda5. Its source tree matches the tested revision above and contains the Neo4j and MongoDB fixes. Main test workflow · DB #605 · DB #606

@vogti
vogti marked this pull request as ready for review November 23, 2026 09:37
@vogti
vogti merged commit a504898 into master Nov 23, 2026
52 checks passed
@vogti
vogti deleted the codex/pep249-error-routing branch November 23, 2026 09:37
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.

1 participant