Skip to content

main_metadata

Definition of the metadata (DB schema) for the artifact store.

DBBase

Bases: DeclarativeBase

Base class for DB table classes.

Source code in mlte/store/artifact/underlying/rdbs/main_metadata.py
37
38
39
40
41
42
43
class DBBase(DeclarativeBase):
    """Base class for DB table classes."""

    @classmethod
    def get_id_column(cls):
        """Method to simplify access to id column, useful for ForeignKeys."""
        return cls.__table__.c.id

get_id_column() classmethod

Method to simplify access to id column, useful for ForeignKeys.

Source code in mlte/store/artifact/underlying/rdbs/main_metadata.py
40
41
42
43
@classmethod
def get_id_column(cls):
    """Method to simplify access to id column, useful for ForeignKeys."""
    return cls.__table__.c.id

init_artifact_types(session)

Initializes the table with the configured artifact types.

Source code in mlte/store/artifact/underlying/rdbs/main_metadata.py
150
151
152
153
154
155
156
157
def init_artifact_types(session: Session):
    """Initializes the table with the configured artifact types."""
    if session.scalars(select(DBArtifactType)).first() is None:
        types = [e.value for e in ArtifactType]
        for type in types:
            type_obj = DBArtifactType(name=type)
            session.add(type_obj)
        session.commit()