kedro-org / kedro-plugins

First-party plugins maintained by the Kedro team.
Apache License 2.0
91 stars 84 forks source link

YAMLDataset kedro-viz preview #716

Closed derluke closed 3 months ago

derluke commented 3 months ago

Description

YAMLDatasets are currently not supported in kedro-viz preview - it would be nice to have it.

Context

YAML is a popular alternative to json, and used extensively throughout kedro.

Possible Implementation

a trivial addition of

    def preview(self) -> JSONPreview:
        """
        Generate a preview of the JSON dataset with a specified number of items.

        Returns:
            A string representing the JSON data for previewing.
        """
        data = self._load()

        return JSONPreview(json.dumps(data))

to kedro_datasets/yaml/yaml_dataset.py (possibly with a try/except around the dump - in case there are any special cases that yaml can do, but json.dumps can't.

datajoely commented 3 months ago

Good push! If you fancy opening a PR this can get released quickly

derluke commented 3 months ago

@datajoely I tried, and failed. The PR is red, but I don't understand why

derluke commented 3 months ago

https://github.com/kedro-org/kedro-plugins/pull/718

DimedS commented 3 months ago

@derluke many thanks for the PR! I re-runned some tests, all right now. I will review and ask teammembers to do it also

ankatiyar commented 3 months ago

Closed by #718