Skip to content

import_store

import_store(import_data, artifact_store, custom_list_store, user_store, catalog_stores, force=False)

Import MLTE store objects from json dict.

Parameters:

Name Type Description Default
import_data dict[str, Any]

Dict of all the store data to be imported.

required
force bool

Flag to overwrite data currently in the stores.

False
Source code in mlte/store/import_export/import_store.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def import_store(
    import_data: dict[str, Any],
    artifact_store: ArtifactStore,
    custom_list_store: CustomListStore,
    user_store: UserStore,
    catalog_stores: CatalogStoreGroup,
    force: bool = False,
) -> None:
    """
    Import MLTE store objects from json dict.

    :param import_data: Dict of all the store data to be imported.
    :param force: Flag to overwrite data currently in the stores.
    """

    if not force:
        _store_check(
            import_data,
            artifact_store,
            custom_list_store,
            user_store,
            catalog_stores,
        )

    if MODELS_KEY in import_data:
        _import_artifacts(import_data[MODELS_KEY], artifact_store, force)
    if CUSTOM_LISTS_KEY in import_data:
        _import_custom_lists(
            import_data[CUSTOM_LISTS_KEY], custom_list_store, force
        )
    if USERS_KEY in import_data:
        _import_users(import_data[USERS_KEY], user_store, force)
    if CATALOG_KEY in import_data:
        _import_catalogs(import_data[CATALOG_KEY], catalog_stores, force)