FolderMixin¶
- class pydelfini.collections.FolderMixin(collection, full_path, core)[source]¶
Bases:
ABCFolder interaction methods as a mixin class.
This class is used by
DelfiniCollectionandDelfiniFolder.Attributes
idpath- Parameters:
collection (DelfiniCollection)
full_path (str | None)
core (AuthenticatedClient)
- __getitem__(item_path)[source]¶
Retrieve an item in this folder.
Relative paths are supported, such as
folder_a/folder_b/item_c.- Parameters:
item_path (str)
- Return type:
- folder(folder_name)[source]¶
Open the named folder.
- Parameters:
folder_name (str) – the name of the folder to open
- Return type:
- new_empty_file(file_name)[source]¶
Create a new, empty file.
- Parameters:
file_name (str) – the name of the file to create
- Return type:
- new_folder(folder_name)[source]¶
Create a new folder.
- Parameters:
folder_name (str) – the name of the folder to create
- Return type:
- new_link(target, link_name=None)[source]¶
Create a new link pointing to a target.
- Parameters:
- Return type:
- write_table(item_path, dataframe, format='csv', overwrite=False, **kwargs)[source]¶
Write a
pd.DataFrameto the named item.If the item already exists and overwrite is False, an error is raised. If overwrite is True and the item exists, its data is overwritten.
- Parameters:
item_path (str) – The path to the item relative to the current folder. Accepts slashes (‘/’) for items in subfolders.
dataframe (DataFrame) – The dataframe to be written.
format (Literal['csv', 'parquet']) – One of the supported formats (
csvorparquet).overwrite (bool) – If True, overwrite existing item data if it exists. If False (default), raises an error if item already exists.
**kwargs (Any) – Any other arguments to be passed to the Pandas export function. See the documentation for
pd.DataFrame.to_csv()orpd.DataFrame.to_parquet()for valid arguments.
- Return type:
None