psycodict.base¶
The shared plumbing underneath every psycodict object.
PostgresBase is the common base of the database, table and
statistics classes; it owns statement execution through _execute
(logging, slow-query warnings, commit/rollback bookkeeping and
reconnection) together with helpers for inspecting tables, indexes and
constraints. The module also defines the layout of the meta_* tables –
the column lists, types and creation statements shared by everything that
reads or writes them – and the metadata format version (META_FORMAT)
stamped into meta_format.
- psycodict.base.jsonb_idx(cols, cols_type)[source]¶
The positions in
colswhose type isjsonb, as a tuple of indexes. Used to decide which values need json decoding when reading rows of themeta_*tables.INPUT:
cols– a list of column namescols_type– a dictionary mapping column names to their types
- psycodict.base.export_format_line()[source]¶
The marker line a new search-data export begins with, without a newline.
- psycodict.base.export_format_version(line)[source]¶
The export-format version a marker line declares.
INPUT:
line– a line known to be a format marker rather than a row of column names.
OUTPUT:
The nonnegative integer version, or a
ValueErroriflineis not exactly# psycodict-export-format: N. A signed or non-decimal version is malformed: psycodict has never written one, so a file carrying one was not written by any psycodict.