Skip to content

metadata

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
19
20
21
22
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
148
149
150
151
152
153
154
155
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
138
139
140
141
142
143
144
145
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()