diff --git a/docs/source/kedro-viz_visualisation.md b/docs/source/kedro-viz_visualisation.md index 04556d7e4..de4509e5b 100644 --- a/docs/source/kedro-viz_visualisation.md +++ b/docs/source/kedro-viz_visualisation.md @@ -194,6 +194,43 @@ The visualisation now includes the layers: ![](./images/pipeline_visualisation_with_layers.png) +Duplicated definitions like: + +```yaml +metadata: + kedro-viz: + layer: raw +``` + +can be avoided by leveraging YAML native syntax for anchors and aliases. + +Use an anchor (`&`) first, to create a reusable piece of configuration: + +```yaml +_raw_layer: &raw_layer + metadata: + kedro-viz: + layer: 01_raw +``` + +And then use aliases (`*`) to reference it: + +```yaml +companies: + type: pandas.CSVDataset + filepath: data/01_raw/companies.csv + <<: *raw_layer + +reviews: + type: pandas.CSVDataset + filepath: data/01_raw/reviews.csv + <<: *raw_layer + +# Same for other datasets of the raw layer... +``` + +See [this example from the Kedro docs](https://docs.kedro.org/en/stable/data/data_catalog_yaml_examples.html#load-multiple-datasets-with-similar-configuration-using-yaml-anchors) for more details. + ## Share a pipeline visualisation You can save a pipeline structure within a Kedro-Viz visualisation directly from the terminal as follows: