Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warnings to top-level use of layer in catalog definition #2964

Merged
merged 9 commits into from
Aug 25, 2023
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
| `AbstractDataset` | `AbstractDataSet` | `kedro.io.core` |
| `AbstractVersionedDataset` | `AbstractVersionedDataSet` | `kedro.io.core` |

* `layer` attribute at the top level is deprecated and will be removed in Kedro 0.19.0. Please move `layer` inside the `metadata` -> `kedro-viz` attributes.
SajidAlamQB marked this conversation as resolved.
Show resolved Hide resolved

# Release 0.18.12

## Major features and improvements
Expand Down
10 changes: 10 additions & 0 deletions kedro/io/data_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ class to be loaded is specified with the key ``type`` and their
dataset_patterns[ds_name] = ds_config

else:
# Check if 'layer' attribute is defined at the top level
if "layer" in ds_config:
import warnings

warnings.warn(
"Defining the 'layer' attribute at the top level is deprecated "
"and will be removed in Kedro 0.19.0. Please move 'layer' inside the 'metadata' -> "
"'kedro-viz' attributes.",
FutureWarning,
SajidAlamQB marked this conversation as resolved.
Show resolved Hide resolved
)
ds_layer = ds_config.pop("layer", None)
if ds_layer is not None:
layers[ds_layer].add(ds_name)
Expand Down