Skip to content

metadata

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

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

DBBase

Bases: DeclarativeBase

Base class for DB table classes.

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

    pass

init_method_types(session)

Initializes the table with the configured method types.

Source code in mlte/store/user/underlying/rdbs/metadata.py
151
152
153
154
155
156
157
158
def init_method_types(session: Session):
    """Initializes the table with the configured method types."""
    if session.scalars(select(DBMethodType)).first() is None:
        types = [e.value for e in MethodType]
        for type in types:
            type_obj = DBMethodType(name=type)
            session.add(type_obj)
        session.commit()

init_role_types(session)

Initializes the table with the configured role types.

Source code in mlte/store/user/underlying/rdbs/metadata.py
141
142
143
144
145
146
147
148
def init_role_types(session: Session):
    """Initializes the table with the configured role types."""
    if session.scalars(select(DBRoleType)).first() is None:
        types = [e.value for e in RoleType]
        for type in types:
            type_obj = DBRoleType(name=type)
            session.add(type_obj)
        session.commit()