Skip to content
Pyrula

Postgres

Generated from the type stubs and docstrings. Do not edit by hand.

A postgres connector call failed; carried on the Err side of the Either.

adbc_dbapi() -> Any
read_arrow(dsn: str, sql: str, parameters: tuple[Any, ...] = (), connect_timeout_s: int = 30) -> Either[Any, PostgresError]

Run a query and return Ok(pyarrow.Table) (Arrow-native fetch, no per-row Python) or Err(PostgresError).

upsert_arrow(dsn: str, table: str, batch: Any, keys: list[str], connect_timeout_s: int = 30) -> Either[None, PostgresError]

Idempotent keyed upsert of an Arrow batch. One transaction, self-commits.

Returns Ok(None) or Err(PostgresError). Replay-safe write for workflow steps: re-running the step upserts on keys rather than appending, so recovery or retry cannot double-write. This is the Postgres counterpart to DeltaTable.merge_keyed. Like write_arrow it self-commits, so do NOT use it from the EOS PostgresSink (which owns its own transaction).

Stages the batch in a TEMP table, then INSERT … SELECT … ON CONFLICT into the target. keys must name the conflict columns (a unique/primary-key constraint on them must already exist); an empty key set would be a plain append and is rejected.

validate_identifier(name: str) -> None
write_arrow(dsn: str, table: str, batch: Any, mode: str = 'create_append', connect_timeout_s: int = 30) -> Either[None, PostgresError]

Ingest an Arrow batch into table. One autocommit-off transaction.

Returns Ok(None) or Err(PostgresError). NON-EOS / workflow-step convenience only. Self-commits - do NOT use from the EOS PostgresSink, which must keep data + checkpoint in one transaction it owns itself.