kedro.io.TextLocalDataSet

class kedro.io.TextLocalDataSet(filepath, load_args=None, save_args=None, version=None)[source]

TextLocalDataSet loads and saves unstructured text files.

Example:

from kedro.io import TextLocalDataSet

string_to_write = "This will go in a file."

data_set = TextLocalDataSet(filepath="docs/new_documentation.md")
data_set.save(string_to_write)
reloaded = data_set.load()
__init__(filepath, load_args=None, save_args=None, version=None)[source]

Creates a new instance of TextFile.

Parameters:
  • filepath (str) – path to a text file.
  • load_args (Optional[Dict[str, Any]]) – Load arguments should be specified in accordance with the built in open function. This can be found at https://docs.python.org/3/library/functions.html#open
  • save_args (Optional[Dict[str, Any]]) – Save arguments should be specified in accordance with the built in open function. This can be found at https://docs.python.org/3/library/functions.html#open
  • version (Optional[Version]) – If specified, should be an instance of kedro.io.core.Version. If its load attribute is None, the latest version will be loaded. If its save attribute is None, save version will be autogenerated.
Return type:

None

Methods

__init__(filepath[, load_args, save_args, …]) Creates a new instance of TextFile.
exists() Checks whether a data set’s output already exists by calling the provided _exists() method.
from_config(name, config[, load_version, …]) Create a data set instance using the configuration provided.
load() Loads data by delegation to the provided load method.
save(data) Saves data by delegation to the provided save method.