CachedDataset
kedro.io.CachedDataset ¶
CachedDataset(dataset, version=None, copy_mode=None, metadata=None)
Bases: AbstractDataset
CachedDataset
is a dataset wrapper which caches in memory the data saved,
so that the user avoids io operations with slow storage media.
You can also specify a CachedDataset
in catalog.yml:
::
>>> test_ds:
>>> type: CachedDataset
>>> versioned: true
>>> dataset:
>>> type: pandas.CSVDataset
>>> filepath: example.csv
Please note that if your dataset is versioned, this should be indicated in the wrapper class as shown above.
Parameters:
-
dataset
(AbstractDataset | dict
) –A Kedro Dataset object or a dictionary to cache.
-
version
(Version | None
, default:None
) –If specified, should be an instance of
kedro.io.core.Version
. If itsload
attribute is None, the latest version will be loaded. If itssave
attribute is None, save version will be autogenerated. -
copy_mode
(str | None
, default:None
) –The copy mode used to copy the data. Possible values are: "deepcopy", "copy" and "assign". If not provided, it is inferred based on the data type.
-
metadata
(dict[str, Any] | None
, default:None
) –Any arbitrary metadata. This is ignored by Kedro, but may be consumed by users or external plugins.
Raises:
-
ValueError
–If the provided dataset is not a valid dict/YAML representation of a dataset or an actual dataset.
Source code in kedro/io/cached_dataset.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
__getstate__ ¶
__getstate__()
Source code in kedro/io/cached_dataset.py
121 122 123 124 125 126 |
|
__repr__ ¶
__repr__()
Source code in kedro/io/cached_dataset.py
99 100 101 102 103 104 |
|
_describe ¶
_describe()
Source code in kedro/io/cached_dataset.py
96 97 |
|
_exists ¶
_exists()
Source code in kedro/io/cached_dataset.py
118 119 |
|
_from_config
staticmethod
¶
_from_config(config, version)
Source code in kedro/io/cached_dataset.py
82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
_release ¶
_release()
Source code in kedro/io/cached_dataset.py
78 79 80 |
|
load ¶
load()
Source code in kedro/io/cached_dataset.py
106 107 108 109 110 111 112 |
|
save ¶
save(data)
Source code in kedro/io/cached_dataset.py
114 115 116 |
|