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

Documentation improvement about create a custom dataset #3654

Open
avonarret opened this issue Feb 26, 2024 · 2 comments
Open

Documentation improvement about create a custom dataset #3654

avonarret opened this issue Feb 26, 2024 · 2 comments
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation

Comments

@avonarret
Copy link

avonarret commented Feb 26, 2024

Description

The documentation at Advanced: Tutorial to create a custom dataset describes how custom datasets can be created. However, the documentation still lacks some details on how to "register" your own dataset, so it can be imported and used by the catalog.load method.

Documentation page (if applicable)

https://docs.kedro.org/en/stable/data/how_to_create_a_custom_dataset.html

Context

According to the current documentation I have created the following file structure:

src/projectname/datasets
├── __init__.py
└── custom_dataset.py

After configuring the catalog.yml as described in the docs and running the catalog.load method in a jupyter notebook, the custom dataset didn't get recognized. The following errors occured:

DatasetError: An exception occurred when parsing config for dataset 'catalogname': Class 'projectname.datasets.CustomDataset' not found, is this a typo?

When using this structure, according to @astrojuanlu there is a pip install . required Slack Conversation.

Possible steps to consider for the docs:

  1. create the custom Dataset according to the recent docs in src/projectname/datasets/datasetname.py with the __init__.py alongside.
  2. Exclude a possible pitfall by explicitely mentioning the (in my case required) lines in __init__.py, this file probably needs
from .custom_dataset.py import CustomDataset
__all__ = ["SFTPCapableCSVDataset"]
  1. cd projectname
  2. pip install .
  3. In conf/base/catalog.yml the type should be projectname.datasets.CustomDataset
    Whereas projectname and CustomDataset have to be exchanged with the according names of the respective project.

With these steps I was able to sucessfully call catalog.load within the jupyter notebook.

@astrojuanlu
Copy link
Member

Thanks for opening this issue @avonarret ! Adding it to our backlog

@astrojuanlu astrojuanlu added the Component: Documentation 📄 Issue/PR for markdown and API documentation label Feb 26, 2024
@noklam
Copy link
Contributor

noklam commented Mar 5, 2024

@avonarret Could you create a minimal project that we can reproduce? I have done this many times and it doesn't require pip install ., so I am surprised if this does not work now. I test it quickly with the current main branch and work as expected.

If the modules are importable, datasets is just one of the module so there is nothing special about it. i.e.
'projectname.datasets.CustomDataset' is this an importable object if you run it from kedro ipython?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation
Projects
Status: No status
Development

No branches or pull requests

4 participants