db.schemas.schema
Module defining base functions and classes for implementing a schema
Module Contents
Classes
Functions
Data
SaveOptionsType
API
emtellipro.db.schemas.schema.SchemaManifest
Bases: object
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.
Initialization
SchemaManifest.name
The name of the schema. This should match the entry-point definition.
SchemaManifest.models
The module containing the SQLAlchemy ORM models.
SchemaManifest.migrations
The migrations module. This can be None if the schema doesn’t support migrations.
Value: None
SchemaManifest.save
Callable that takes in the documents to store.
SchemaManifest.save_options
The SaveOptions class that can be passed to the save function. If not
passed explictly when instantiating SchemaManifest, it will be discovered
by inspecting the type annotation for the save() function’s
options parameter.
Value: None
SchemaManifest.__post_init__
SchemaManifest.metadata
The base SQLAlchemy metadata
SchemaManifest.alembic_config
Path to alembic config file.
Return type: Config
SchemaManifest.tables
The list of tables in the SQLAlchemy metadata object.
emtellipro.db.schemas.schema.SaveDocument
Bases: object
This stores references to the input document and annotated document pair
that should be passed to the save() method in each schema.
Initialization
SaveDocument.annotated
Type: AnnotatedDocument
The annotated document to save.
SaveDocument.input
Type: InputDocument | None
Optional input document. Some save functions may not require this, but some do to compute things like annotation texts when emtelliPro did not return it.
Value: None
SaveDocument.text
emtellipro.db.schemas.schema.SaveOptions
Bases: object
Base class for the save options for each save function.
emtellipro.db.schemas.schema.SaveOptionsType
Value: TypeVar(...)
emtellipro.db.schemas.schema.save_options_replace
Replace the attributes of options with matching values from
replacements.
Parameters:
The SaveOptions subclass instance from some schema.
Attributes to replace in the options instance. Only keys which
match attributes of the options object will be used; any other
keys will be ignored.
Returns:
A new instance of the same type as options, with changed attributes.
Return type: SaveOptionsType

