db.schemas.schema

emtellipro.db.schemas.schema

Module defining base functions and classes for implementing a schema

Module Contents

Classes

NameDescription
SchemaManifestRepresentation of a database schema, containing the SQLAlchemy metadata object, and the module implementing it.
SaveDocumentThis stores references to the input document and annotated document pair that should be passed to the save() method in each schema.
SaveOptionsBase class for the save options for each save function.

Functions

NameDescription
save_options_replaceReplace the attributes of options with matching values from replacements.

Data

SaveOptionsType

API

emtellipro.db.schemas.schema.SchemaManifest

1class emtellipro.db.schemas.schema.SchemaManifest

Representation of a database schema, containing the SQLAlchemy metadata object, and the module implementing it.

Authors of schemas must provide an object that is an instance of this class (or a subclass). This class itself can be instantiated, but if some of the properties need to be overridden, then a subclass will be necessary.

SchemaManifest.name
1name: str

Value: None

SchemaManifest.models
1models: typing.Any

Value: None

SchemaManifest.migrations
1migrations: typing.Any | None

Value: None

SchemaManifest.save
1save: typing.Callable

Value: None

SchemaManifest.save_options
1save_options: type | None

Value: None

SchemaManifest.__post_init__
1__post_init__()
SchemaManifest.metadata
1metadata

The base SQLAlchemy metadata

SchemaManifest.alembic_config
1alembic_config: alembic.config.Config

Path to alembic config file.

SchemaManifest.tables
1tables

The list of tables in the SQLAlchemy metadata object.

emtellipro.db.schemas.schema.SaveDocument

1class emtellipro.db.schemas.schema.SaveDocument

This stores references to the input document and annotated document pair that should be passed to the save() method in each schema.

SaveDocument.annotated
1annotated: emtellipro.data.AnnotatedDocument

Value: None

SaveDocument.input
1input: emtellipro.data.InputDocument | None

Value: None

SaveDocument.text
1text

emtellipro.db.schemas.schema.SaveOptions

1class emtellipro.db.schemas.schema.SaveOptions

Base class for the save options for each save function.

emtellipro.db.schemas.schema.SaveOptionsType

1emtellipro.db.schemas.schema.SaveOptionsType

Value: TypeVar(...)

emtellipro.db.schemas.schema.save_options_replace

1emtellipro.db.schemas.schema.save_options_replace(
2 options: emtellipro.db.schemas.schema.SaveOptionsType, **replacements
3) -> emtellipro.db.schemas.schema.SaveOptionsType

Replace the attributes of options with matching values from replacements.

Parameters:

options
emtellipro.db.schemas.schema.SaveOptionsType

Returns:

A new instance of the same type as options, with changed attributes.