relstorage.adapters.schema – Database schema installers#

Database schema installers

class AbstractSchemaInstaller(connmanager, runner, keep_history)[source]#

Bases: DatabaseHelpersMixin, ABC

CREATE_BLOB_CHUNK_TMPL()#

Query for CREATE_BLOB_CHUNK

CREATE_OBJECT_REFS_ADDED_TMPL()#

Query for CREATE_OBJECT_REFS_ADDED

CREATE_OBJECT_REF_TMPL()#

Query for CREATE_OBJECT_REF

CREATE_OBJECT_STATE_TMPL()#

Query for CREATE_OBJECT_STATE

create_procedures(cursor)[source]#

Subclasses should override

create_sequences(cursor)[source]#

Subclasses should override.

create_tables(cursor, existing_tables=())[source]#

Create the database tables.

create_triggers(cursor)[source]#

Subclasses should override

drop_all()[source]#

Drop all tables and sequences.

update_schema(cursor, tables)[source]#

Perform any migration steps that are needed to make a schema that has already been created some time in the past match what would currently be installed.

Subclasses may override.

zap_all(reset_oid=True, slow=False)[source]#

Clear all data out of the database.

Parameters:

slow (bool) – If True (not the default) then database specific optimizations will be skipped and rows will simply be DELETEd. This is helpful when other connections might be open and holding some kind of locks.

COLTYPE_BINARY_STRING = 'BYTEA'#

The type of the column used to hold binary strings. Our default is appropriate for PostgreSQL.

COLTYPE_BLOB_CHUNK = 'OID'#

The type of the column used to store blob chunks.

COLTYPE_BLOB_CHUNK_NUM = 'BIGINT'#

The type of the column used to number blob chunks.

COLTYPE_MD5 = 'CHAR(32)'#

The type of the column used to store MD5 hash strings.

COLTYPE_OID_TID = 'BIGINT'#

The type of the column used to hold transaction IDs and object IDs (64-bit integers).

TRANSACTIONAL_TABLE_SUFFIX = ''#

The suffix needed (after the closing ‘)’) to make sure a table behaves in a transactional manner. Our default is appropriate for PostgreSQL.