DelfiniFolder¶
- class pydelfini.collections.DelfiniFolder(collection, in_folder, model, core)[source]¶
Bases:
DelfiniItem
,FolderMixin
Represents a folder within a collection.
Note that folders cannot be opened as data streams, so the
open()
method will always returnOSError
.Attributes
Item column definitions
Datetime item was created
Item internal ID
Item metadata
Item name
Item parser settings
Item fully qualified path
Item type (
file
,folder
,dataview
, etc.)Collection that contains this item
Folder that contains this item
- Parameters:
collection (DelfiniCollection)
in_folder (FolderMixin)
model (Item)
core (AuthenticatedClient)
- __getitem__(item_path)¶
Retrieve an item in this folder.
Relative paths are supported, such as
folder_a/folder_b/item_c
.- Parameters:
item_path (str)
- Return type:
- __iter__()¶
Iterate over all items in this folder.
- Return type:
- collection: DelfiniCollection¶
Collection that contains this item
- property columns: list[ItemColumn] | None¶
Item column definitions
- folder(folder_name)¶
Open the named folder.
- Parameters:
folder_name (str) – the name of the folder to open
- Return type:
- get_table(item_path)¶
Retrieve the tabular contents of an item as a
pd.DataFrame
.
- in_folder: FolderMixin¶
Folder that contains this item
- new_empty_file(file_name)¶
Create a new, empty file.
- Parameters:
file_name (str) – the name of the file to create
- Return type:
- new_folder(folder_name)¶
Create a new folder.
- Parameters:
folder_name (str) – the name of the folder to create
- Return type:
- new_link(target, link_name=None)¶
Create a new link pointing to a target.
- Parameters:
- Return type:
- open(mode: Literal['rb', 'wb']) BinaryIO [source]¶
- open(mode: Literal['r', 'w']) TextIO
N/A - folders cannot be opened.
Raises:
IsADirectoryError
always
- property parser: ItemParser | None¶
Item parser settings
- walk()¶
Iterate over all items in this folder, and all subfolders.
- Return type:
- write_table(item_path, dataframe, format='csv', **kwargs)¶
Write a
pd.DataFrame
to the named item.- 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 (
csv
orparquet
).**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