datakiln.metadata.files module

Data files of the tables.

class datakiln.metadata.files.LocalFile(path: Path, repo: LocalRepo)[source]

Bases: dict

Local file or folder, with the keys of one that DVC tracks. Its checksum is computed when it is needed, as that takes reading it.

class datakiln.metadata.files.LocalRepo(root_dir: Path)[source]

Bases: object

Folder of data files that DVC does not track. It has the part of a DVC repository, and of its file system, that the tables use, so that there is nothing to fetch.

listdir(path: str, dvc_only: bool = False) → List[LocalFile][source]

Files and folders, other than the hidden ones and the ones of DVC.

Parameters:
  • path (str) – Folder in the root.

  • dvc_only (bool) – Ignored, as every file is local.

Return type:

list[LocalFile]

pull(targets)[source]

Nothing is fetched, since the files are local.

Returns:

What was fetched, which is nothing.

Return type:

dict

class datakiln.metadata.files.DataFiles(directory: Path)[source]

Bases: object

Data files of the tables. They are the ones DVC tracks if the folder is a DVC repository, and the ones in it otherwise.

find(name: str) → dict[source]

Find the data of a table.

Parameters:

name (str) – Name of the table metadata, in lower case.

Returns:

Name of the file or folder in the folder of the data files, its checksum and the repository it belongs to.

Return type:

dict

Raises:

FileNotFoundError – If there is no file for the table.