CRUD
delete_dataitem(identifier, project=None, entity_id=None, delete_all_versions=False, **kwargs)
Delete object from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
entity_id |
str
|
Entity ID. |
None
|
delete_all_versions |
bool
|
Delete all versions of the named entity. If True, use entity name instead of entity key as identifier. |
False
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
dict
|
Response from backend. |
Examples:
If delete_all_versions is False:
Otherwise:
>>> obj = delete_dataitem("my-dataitem-name",
>>> project="my-project",
>>> delete_all_versions=True)
Source code in digitalhub_data/entities/dataitem/crud.py
get_dataitem(identifier, project=None, entity_id=None, **kwargs)
Get object from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
entity_id |
str
|
Entity ID. |
None
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
Dataitem
|
Object instance. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_data/entities/dataitem/crud.py
get_dataitem_versions(identifier, project=None, **kwargs)
Get object versions from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
list[Dataitem]
|
List of object instances. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_data/entities/dataitem/crud.py
import_dataitem(file)
Import object from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
Path to YAML file. |
required |
Returns:
Type | Description |
---|---|
Dataitem
|
Object instance. |
Examples:
Source code in digitalhub_data/entities/dataitem/crud.py
list_dataitems(project, **kwargs)
List all latest version objects from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
list[Dataitem]
|
List of object instances. |
Examples:
Source code in digitalhub_data/entities/dataitem/crud.py
log_dataitem(project, name, kind, source=None, data=None, extension=None, path=None, **kwargs)
Log a dataitem to the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
name |
str
|
Object name. |
required |
kind |
str
|
Kind the object. |
required |
source |
str
|
Dataitem location on local path. |
None
|
data |
Any
|
Dataframe to log. Alternative to source. |
None
|
extension |
str
|
Extension of the output dataframe. |
None
|
path |
str
|
Destination path of the dataitem. If not provided, it's generated. |
None
|
**kwargs |
dict
|
New dataitem spec parameters. |
{}
|
Returns:
Type | Description |
---|---|
Dataitem
|
Object instance. |
Examples:
Source code in digitalhub_data/entities/dataitem/crud.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
new_dataitem(project, name, kind, uuid=None, description=None, labels=None, embedded=True, path=None, **kwargs)
Create a new object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
name |
str
|
Object name. |
required |
kind |
str
|
Kind the object. |
required |
uuid |
str
|
ID of the object (UUID4, e.g. 40f25c4b-d26b-4221-b048-9527aff291e2). |
None
|
description |
str
|
Description of the object (human readable). |
None
|
labels |
list[str]
|
List of labels. |
None
|
embedded |
bool
|
Flag to determine if object spec must be embedded in project spec. |
True
|
path |
str
|
Object path on local file system or remote storage. It is also the destination path of upload() method. |
None
|
**kwargs |
dict
|
Spec keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Dataitem
|
Object instance. |
Examples:
>>> obj = new_dataitem(project="my-project",
>>> name="my-dataitem",
>>> kind="dataitem",
>>> path="s3://my-bucket/my-key")