DelfiniItem

class pydelfini.collections.DelfiniItem(collection, in_folder, model, core)[source]

Bases: object

Represents an item within a collection.

Attributes

columns

Item column definitions

created_on

Datetime item was created

id

Item internal ID

metadata

Item metadata

name

Item name

parser

Item parser settings

path

Item fully qualified path

type

Item type (file, folder, dataview, etc.)

collection

Collection that contains this item

in_folder

Folder that contains this item

Parameters:
Return type:

DelfiniItem

collection: DelfiniCollection

Collection that contains this item

property columns: list[ItemColumn] | None

Item column definitions

property created_on: datetime

Datetime item was created

property id: str

Item internal ID

in_folder: FolderMixin

Folder that contains this item

property metadata: dict[str, str]

Item metadata

property name: str

Item name

open(mode: Literal['rb', 'wb']) BinaryIO[source]
open(mode: Literal['r', 'w']) TextIO

Open this item for reading or writing.

When writing an item, it is important to use the returned file-like object either in a context manager or else call its close() method when writing is complete, otherwise the full contents of the file may not be written.

Suggested usage:

with item.open('wb') as fp:
    fp.write(b'my item content, as much as I have\n')
Parameters:

mode

One of the following values, depending on the desired interaction mode:

  • r - reading, text mode

  • rb - reading, binary mode

  • w - writing, text mode

  • wb - writing, binary mode

Returns:

A file-like interface, either BinaryIO or TextIO depending on whether the file was to be opened in binary or text mode. When writing, the return will be an instance of item_io.DelfiniItemWriterBinary or item_io.DelfiniItemWriterText.

property parser: ItemParser | None

Item parser settings

property path: str

Item fully qualified path

table()[source]

Retrieve the tabular contents of this item as a pd.DataFrame.

Return type:

DataFrame

property type: ItemType

Item type (file, folder, dataview, etc.)