def _get_metric_hub_namespaces()

in generator/namespaces.py [0:0]


def _get_metric_hub_namespaces(existing_namespaces):
    metric_hub_data_sources = _get_metric_hub_data_sources()

    metric_hub_namespaces = {}
    for namespace, metric_hub_data_sources in metric_hub_data_sources.items():
        # each data source definition is represented by a view and an explore
        explores = {}
        views = {}
        for data_source in sorted(metric_hub_data_sources):
            views[f"metric_definitions_{data_source}"] = {
                "type": "metric_definitions_view"
            }

            explores[f"metric_definitions_{data_source}"] = {
                "type": "metric_definitions_explore",
                "views": {"base_view": f"metric_definitions_{data_source}"},
            }

        metric_hub_namespaces[namespace] = {
            "pretty_name": lookml_utils.slug_to_title(namespace),
            "views": views,
            "explores": explores,
        }

    return metric_hub_namespaces