Define uses_psycopg2_extras on both Postgres engines

The driver-agnostic base declares it and the executescript path reads it, but neither concrete engine set it, so booting on the Rust engine failed with an AttributeError in schema preparation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULdieJyQoHNzeHq42H2M1p
This commit is contained in:
Erik JohnstonandClaude Fable 5.1 committed 2026-10-12 18:31:06 +00:00
1 parent 8e4932ded5
commit ec68f0b8f6
2 files changed
+9

No files matched your search

+4
View File
@@ -43,6 +43,10 @@ class Psycopg2Engine(
):
"""The Postgres backend that talks to the database via psycopg2."""
# psycopg2's cursor is a real psycopg2 cursor, so the `psycopg2.extras`
# helpers can be used on it directly.
uses_psycopg2_extras: bool = True
def __init__(self, database_config: Mapping[str, Any]):
super().__init__(psycopg2, database_config)
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
+5
View File
@@ -57,6 +57,11 @@ _RETRYABLE_PGCODES = ("40001", "40P01")
class RustPostgresEngine(PostgresEngine[Connection, Cursor]):
"""A :class:`PostgresEngine` that talks to the Rust backend's shim."""
# The shim cursor is not a psycopg2 cursor, so the `psycopg2.extras`
# helpers can't be used on it; `LoggingTransaction.executescript` takes the
# shim's own multi-statement path instead.
uses_psycopg2_extras: bool = False
# SQL isolation-level names for each `IsolationLevel`. The shim has no
# psycopg2-style `set_isolation_level`, so a per-transaction override is
# applied as a `SET SESSION CHARACTERISTICS` statement (see