Hi Kedronistas. When I define an `AbstractDataSet`...
# questions
f
Hi Kedronistas. When I define an
AbstractDataSet
,
kedro-viz
does not display the Dataset Type and the File Path property in the details section for that Dataset. How can I make them show up?
a
What does the definition of your
AbstractDataSet
look like? I would expect this to work already 🤔
f
quite straight forward to test:
Copy code
from typing import Dict
from pathlib import Path, PurePosixPath
import dask.dataframe as dd
from <http://kedro.io|kedro.io> import AbstractDataSet

class DaskCSVDataSet(AbstractDataSet):
    def __init__(self, filepath, param1, param2=True):
        self._filepath = PurePosixPath(filepath)
        self._param1 = param1
        self._param2 = param2

    def _load(self) -> Dict[str, dd.DataFrame]:
        # Implement logic to load multiple CSV files as Dask DataFrame
        first_row = dd.read_csv(self._filepath, include_path_column=True, sep=';').head(n=0)
        headers = dd.read_csv(self._filepath, include_path_column=True, sep=';', skiprows=[0]).head(n=2)
        ddf = dd.read_csv(self._filepath, include_path_column=True, sep=';', skiprows=[0,1,3])
        return {"first_row": first_row, "headers": headers, "ddf": ddf}

    def _save(self, data: dd.DataFrame) -> None:
        raise NotImplementedError("Saving Dask DataFrame as CSV is not supported")

    def _describe(self):
        return "hello csv"

    def _exists(self) -> bool:
        return Path(self._filepath.as_posix()).exists()
What is weird to me: When I start kedro-viz in CLI again, for a second at least the correct dataset type (
DaskCSVDataSet
) but instantly disappears again and is replaced with
-
.
🤔 1
a
Ah, I think I know why this might be… Can you try adding a
_describe
method like is done here? https://docs.kedro.org/en/stable/extend_kedro/custom_datasets.html#the-complete-example
👍🏼 1
👍🏽 1
f
Awesome, that solved it 🥳 Thank you!
🥳 1