Provided Methods
- Get Data Table Properties and Metadata (by name/id)
- Change Data Table Metadata (by name/id/reference)
Method documentation
All the examples expect that there is already a OneDataApi object initialised and assigned to a variable called "onedata_api".
### Creation of the ONE DATA Api ###
onedata_api = OneDataApi(base_url=base_url, username=user,
password=pw, verify=False, timeout=999)
get
Description
Retrieves a Data Table with the given data id XOR by name and project id.
Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.
Returns: DataTable
Parameters
Property | Type | Required | Default | Description |
---|---|---|---|---|
id | Union[str, uuid.UUID] | false | None | ID of the data table |
name | str | false | None | name of the data table |
project_id | Union[str, uuid.UUID] | false | None | ID of the project |
force_exact_match | bool | false | True | Search for exact match, False: Data table includes the name |
force_distinct | bool | false | True | Raise exception if name is ambiguous, False: execute on first match |
create_fallback | bool | false | True | defines whether a fall back data table should be created (contains all malformed entries) |
deleted | [Union[str, uuid.UUID]] | false | None | list of row ids, defining the rows that should be deleted |
updated | [dict] | false | None | list of dictionaries, defining the rows that should be updated |
added | [dict] | false | None | list of dictionaries, defining the rows that should be added |
Usage
### Retrieval of a datatable ###
datatable: DataTable = onedata_api.datatables.get(name=datatable_name, project_id=project_id, force_exact_match=True)
update
Description
Updates a Data Table with the given data id XOR by name and project id.
Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.
Returns: DataTable
Parameters
Property | Type | Required | Default | Description |
---|---|---|---|---|
data_id | Union[str, uuid.UUID] | false | None | ID of the data table |
name | str | false | None | name of the data table |
project_id | Union[str, uuid.UUID] | false | None | ID of the project the data tables belongs to. When get by id, project_id will be ignored. |
force_exact_match | bool | false | True | Search for exact match, False: Data table includes the name |
force_distinct | bool | false | True | Raise exception if name is ambiguous, False: execute first match |
new_name | str | false | None | new name for the data table |
new_tags | [str] | false | None | new tags for the data table |
new_description | str | false | None | new description for the data table |
new_notes | str | false | None | new notes for the data table |
new_attributes | dict | false | None | new attributes for the data table |
new_attributes_operator | AttributesOperator | false | None | new attributesOperator for the data table |
new_locked | DatasetLock | false | None | new locked for the data table |
new_home_project_id | Union[str, uuid.UUID] | false | None | new home project for the data table |
Usage
### Update of datatable by id ###
datatable: DataTable = onedata_api.datatables.get(id=datatable_id)
print(f"datatable.description: {datatable.description}")
###
# datatable.description: ""
###
description = "Hey, I am the new fancy description. Set by Python SDK. COOL, hum? Hum?"
datatable: DataTable = onedata_api.datatables.update_by_id(data_id=datatable.id, new_description=description)
print(f"datatable.description: {datatable.description}")
###
# datatable.description: "Hey, I am the new fancy description. Set by Python SDK. COOL, hum? Hum?"
###
updateByReference
Description
Updates a Data Table with the given data table object.
Optional request options (request_transformers, response_transformers, timeout, verify, sleep_after_response_millis, deserializer) can be specified.
Returns: DataTable
Parameters
Property | Type | Required | Default | Description |
---|---|---|---|---|
data_table | DataTable | True | - | data table to update |
Usage
### Update of datatable ###
datatable: DataTable = onedata_api.datatables.get(id=datatable_id)
print(f"datatable.description: {datatable.description}")
###
# datatable.description: ""
###
datatable.description = "Hey, I am the new fancy description. Set by Python SDK. COOL, hum? Hum?"
datatable: DataTable = onedata_api.datatables.update(data_table=datatable)
print(f"datatable.description: {datatable.description}")
###
# datatable.description: "Hey, I am the new fancy description. Set by Python SDK. COOL, hum? Hum?"
###