Use a dataitem
The common Dataitem object methods apply across dataitem kinds. They let you persist or refresh an entity and handle its files.
Persist and refresh
These methods interact with the entity in the backend or locally.
export
File I/O
Use these methods to handle dataitem files.
as_file
download
Download the entity's files to a local destination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
destination
|
str
|
Local destination directory. If omitted, use the project context directory for this entity type. |
None
|
overwrite
|
bool
|
Whether to overwrite existing files. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Destination path returned by the store. |
upload
Upload local files to the entity's storage path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
SourcesOrListOfSources
|
Local file or files to upload. |
required |
keep_dir_structure
|
bool
|
Whether to preserve the source directory structure. |
False
|
Raises:
| Type | Description |
|---|---|
EntityErrorFileNotFound
|
If a source file does not exist. |
EntityError
|
If the upload fails for another supported storage or filesystem error. |
Kind-specific methods
The table and croissant kinds add methods for working with their data. See the dataitem kind references.