Skip to content

create_model

Functions:

create_record_type_model

create_record_type_model(
    model_name: str, detail_metadata: list[dict]
) -> BaseModel

Each detail's set of metadata must be a dictionary with the following keys: dty_ID, rst_DisplayName, dty_Type, rst_MaxValues

Examples:

>>> d1 = {'dty_ID': 1,
... 'rst_DisplayName': 'label',
... 'dty_Type': 'enum',
... 'rst_MaxValues': 1}
>>> d2 = {'dty_ID': 2,
... 'rst_DisplayName': 'date',
... 'dty_Type': 'date',
... 'rst_MaxValues': 1}
>>> model = create_record_type_model('test', [d1, d2])
>>> model.__annotations__.keys()
dict_keys(['id', 'type', 'DTY1', 'DTY1_TRM', 'DTY2'])

Parameters:

  • model_name

    (str) –

    The model's name.

  • detail_metadata

    (list[dict]) –

    A list of metadata about each field (detail).

Return

(BaseModel): Pydantic model.