Skip to content

Kedro integration

vizro.integrations.kedro

Functions to use the Kedro Data Catalog inside Vizro.

Usage documentation

How to integrate Vizro with the Kedro Data Catalog

catalog_from_project

catalog_from_project(project_path=None, **kwargs)

Fetches a Kedro project's Data Catalog.

Parameters:

  • project_path (str | Path | None, default: None ) –

    Path to the Kedro project root directory. If not specified then attempts to find a Kedro project in the current directory or above.

Other Parameters:

  • **kwargs (Any) –

    Keyword arguments to pass to KedroSession.create, for example env.

Returns:

  • DataCatalog

    Kedro Data Catalog.

Example
from vizro.integrations import kedro as kedro_integration

catalog = kedro_integration.catalog_from_project("/path/to/kedro/project")

datasets_from_catalog

datasets_from_catalog(catalog, *, pipeline=None)

Fetches a Kedro Data Catalog's pandas dataset loading functions to use in the Vizro data manager.

Parameters:

  • catalog (DataCatalog) –

    Kedro Data Catalog.

  • pipeline (Pipeline, default: None ) –

    Optional Kedro pipeline. If specified, the factory-based Kedro datasets it defines are also returned.

Returns:

  • dict[str, pd_DataFrameCallable]

    Mapping of dataset names to dataset loading functions that can be used in the Vizro data manager.

Example
from vizro.integrations import kedro as kedro_integration
from vizro.managers import data_manager

for dataset_name, dataset_loader in kedro_integration.datasets_from_catalog(catalog).items():
    data_manager[dataset_name] = dataset_loader

pipelines_from_project

pipelines_from_project(project_path=None)

Fetches a Kedro project's pipelines.

Parameters:

  • project_path (str | Path | None, default: None ) –

    Path to the Kedro project root directory. If not specified then attempts to find a Kedro project in the current directory or above.

Returns:

  • dict[str, Pipeline]

    Mapping of pipeline names to pipelines.

Example
from vizro.integrations import kedro as kedro_integration

pipelines = kedro_integration.pipelines_from_project("/path/to/kedro/project")