Skip to content

metadata

mlte/store/catalog/underlying/rdbs/metadata.py

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

DBBase

Bases: DeclarativeBase

Base class for DB table classes.

Source code in mlte/store/catalog/underlying/rdbs/metadata.py
23
24
25
26
class DBBase(DeclarativeBase):
    """Base class for DB table classes."""

    pass

init_catalog_entry_types(session)

Initializes the table with the configured catalog entry types.

Source code in mlte/store/catalog/underlying/rdbs/metadata.py
90
91
92
93
94
95
96
97
def init_catalog_entry_types(session: Session):
    """Initializes the table with the configured catalog entry types."""
    if session.scalars(select(DBCatalogEntryType)).first() is None:
        types = [e.value for e in CatalogEntryType]
        for type in types:
            type_obj = DBCatalogEntryType(name=type)
            session.add(type_obj)
        session.commit()