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: str | Path | None = None, **kwargs: Any
) -> DataCatalog

Fetches a Kedro project's Data Catalog.

PARAMETER DESCRIPTION
project_path

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

TYPE: str | Path | None DEFAULT: None

PARAMETER DESCRIPTION
**kwargs

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

TYPE: Any

RETURNS DESCRIPTION
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: DataCatalog, *, pipeline: Pipeline = None
) -> dict[str, pd_DataFrameCallable]

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

PARAMETER DESCRIPTION
catalog

Kedro Data Catalog.

TYPE: DataCatalog

pipeline

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

TYPE: Pipeline DEFAULT: None

RETURNS DESCRIPTION
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: str | Path | None = None,
) -> dict[str, Pipeline]

Fetches a Kedro project's pipelines.

PARAMETER DESCRIPTION
project_path

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

TYPE: str | Path | None DEFAULT: None

RETURNS DESCRIPTION
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")