Skip to content

Dashboards

dadosfera.services.maestro.get_all_metabase_dashboards

get_all_metabase_dashboards(maestro_base_url, token)

Retrieve all dashboards from Maestro with a valid dashboard_id.

PARAMETER DESCRIPTION
maestro_base_url

Base URL of the Maestro instance (e.g., 'https://maestro.example.com/api').

TYPE: str

token

Authentication token for API access.

TYPE: str

RETURNS DESCRIPTION

List[Dict]: List of dashboards with valid dashboard_id.

Example: >>> assets = get_all_metabase_dashboards( ... maestro_base_url="https://maestro.example.com/api", ... token="bearer_token_123") >>> logger.info(f"Retrieved {len(assets)} Metabase Dashboards")

Source code in dadosfera/services/maestro/dashboards.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def get_all_metabase_dashboards(maestro_base_url: str, token: str):
    """Retrieve all dashboards from Maestro with a valid dashboard_id.

    Args:
        maestro_base_url (str): Base URL of the Maestro instance
            (e.g., 'https://maestro.example.com/api').
        token (str): Authentication token for API access.

    Returns:
        List[Dict]: List of dashboards with valid dashboard_id.
    Example:
        >>> assets = get_all_metabase_dashboards(
        ...     maestro_base_url="https://maestro.example.com/api",
        ...     token="bearer_token_123")
        >>> logger.info(f"Retrieved {len(assets)} Metabase Dashboards")

    """
    data_assets = data_assets.fetch_paginated_catalog_assets(
        maestro_base_url=maestro_base_url,
        token=token,
        additional_params={"data_asset_type": "dashboard"},
    )
    return [
        data_asset
        for data_asset in data_assets
        if data_asset.get("dashboard_id") is not None
    ]