def METHOD_NAME(
    session: Session, configs: dict[str, Any], overwrite: bool = False
) -> None:
    # discover datasets associated with charts
    dataset_uuids: set[str] = set()
    for file_name, config in configs.items():
        if file_name.startswith("charts/"):
            dataset_uuids.add(config["dataset_uuid"])
    # discover databases associated with datasets
    database_uuids: set[str] = set()
    for file_name, config in configs.items():
        if file_name.startswith("datasets/") and config["uuid"] in dataset_uuids:
            database_uuids.add(config["database_uuid"])
    # import related databases
    database_ids: dict[str, int] = {}
    for file_name, config in configs.items():
        if file_name.startswith("databases/") and config["uuid"] in database_uuids:
            database = import_database(session, config, overwrite=False)
            database_ids[str(database.uuid)] = database.id
    # import datasets with the correct parent ref
    datasets: dict[str, SqlaTable] = {}
    for file_name, config in configs.items():
        if (
            file_name.startswith("datasets/")
            and config["database_uuid"] in database_ids
        ):
            config["database_id"] = database_ids[config["database_uuid"]]
            dataset = import_dataset(session, config, overwrite=False)
            datasets[str(dataset.uuid)] = dataset
    # import charts with the correct parent ref
    for file_name, config in configs.items():
        if file_name.startswith("charts/") and config["dataset_uuid"] in datasets:
            # update datasource id, type, and name
            dataset = datasets[config["dataset_uuid"]]
            config.update(
                {
                    "datasource_id": dataset.id,
                    "datasource_type": "table",
                    "datasource_name": dataset.table_name,
                }
            )
            config["params"].update({"datasource": dataset.uid})
            if "query_context" in config:
                del config["query_context"]
            import_chart(session, config, overwrite=overwrite)