alembic_pg_autogen.diff¶
Diff logic for comparing canonical catalog snapshots.
Module Contents¶
Classes¶
The kind of operation needed to reconcile current state with desired state. |
|
A single diff operation on a PostgreSQL function. |
|
A single diff operation on a PostgreSQL trigger. |
|
A single diff operation on a PostgreSQL view. |
|
Result of comparing two canonical catalog snapshots. |
Functions¶
Compare two canonical catalog snapshots and produce diff operations. |
|
Diff two sequences of catalog items by identity key (all fields except the last |
Data¶
API¶
- alembic_pg_autogen.diff.log = 'getLogger(...)'¶
- class alembic_pg_autogen.diff.Action(*args, **kwds)¶
Bases:
enum.EnumThe kind of operation needed to reconcile current state with desired state.
Initialization
- CREATE = 'create'¶
- REPLACE = 'replace'¶
- DROP = 'drop'¶
- class alembic_pg_autogen.diff.FunctionOp¶
Bases:
typing.NamedTupleA single diff operation on a PostgreSQL function.
- action: alembic_pg_autogen.diff.Action = None¶
- current: alembic_pg_autogen.inspect.FunctionInfo | None = None¶
- desired: alembic_pg_autogen.inspect.FunctionInfo | None = None¶
- class alembic_pg_autogen.diff.TriggerOp¶
Bases:
typing.NamedTupleA single diff operation on a PostgreSQL trigger.
- action: alembic_pg_autogen.diff.Action = None¶
- current: alembic_pg_autogen.inspect.TriggerInfo | None = None¶
- desired: alembic_pg_autogen.inspect.TriggerInfo | None = None¶
- class alembic_pg_autogen.diff.ViewOp¶
Bases:
typing.NamedTupleA single diff operation on a PostgreSQL view.
- action: alembic_pg_autogen.diff.Action = None¶
- current: alembic_pg_autogen.inspect.ViewInfo | None = None¶
- desired: alembic_pg_autogen.inspect.ViewInfo | None = None¶
- class alembic_pg_autogen.diff.DiffResult¶
Bases:
typing.NamedTupleResult of comparing two canonical catalog snapshots.
- function_ops: collections.abc.Sequence[alembic_pg_autogen.diff.FunctionOp] = None¶
- trigger_ops: collections.abc.Sequence[alembic_pg_autogen.diff.TriggerOp] = None¶
- view_ops: collections.abc.Sequence[alembic_pg_autogen.diff.ViewOp] = ()¶
- alembic_pg_autogen.diff._InfoT = 'TypeVar(...)'¶
- alembic_pg_autogen.diff._OpT = 'TypeVar(...)'¶
- alembic_pg_autogen.diff.diff(current: alembic_pg_autogen.canonicalize.CanonicalState, desired: alembic_pg_autogen.canonicalize.CanonicalState) alembic_pg_autogen.diff.DiffResult¶
Compare two canonical catalog snapshots and produce diff operations.
Matches functions by
(schema, name, identity_args), triggers by(schema, table_name, trigger_name), and views by(schema, name). Objects present only in desired produceCREATEops, objects only in current produceDROPops, and objects in both with differing definitions produceREPLACEops.- Args:
current: The current database state (from inspection). desired: The desired state (from canonicalization).
- Returns:
A
DiffResultwith sorted sequences of function, trigger, and view ops.
- alembic_pg_autogen.diff._diff_items(current_items: collections.abc.Sequence[alembic_pg_autogen.diff._InfoT], desired_items: collections.abc.Sequence[alembic_pg_autogen.diff._InfoT], make_op: collections.abc.Callable[[alembic_pg_autogen.diff.Action, alembic_pg_autogen.diff._InfoT | None, alembic_pg_autogen.diff._InfoT | None], alembic_pg_autogen.diff._OpT]) list[alembic_pg_autogen.diff._OpT]¶
Diff two sequences of catalog items by identity key (all fields except the last
definitionfield).