Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi,
I would like to add custom data on datasets.
Custom fields component seems to be the thing I need, they're appear on dataset summary page so it's easy to configure them, but I didn't find a way to read them in python recipes via dataiku API. I thought I can read them with the read_metadata() or get_metadata() methods but it's not the case
In another way, I tried to use custom metadata. I configure them via dataiku API, but I don't fin where they appear on dataset summary page.
- is it possible to read custom fields via DSS python API?
- are supposed custom metadata to be displayed on dataset summary page?
With many thanks for your help.
Regards.
C.
Hi,
You can programmatically retrieve the custom fields of a dataset using the DSS Dataset API, for example in your recipe you would have something like this:
import dataiku
client = dataiku.api_client()
project = client.get_project(dataiku.get_custom_variables()["projectKey"])
# Get a dataset handle for the public API, not a dataiku.Dataset object
dataset = project.get_dataset("YOUR_DATASET")
dataset_settings = dataset.get_settings()
custom_fields = dataset_settings.get_raw()["customFields"]
Best,
Harizo
Hi,
You can programmatically retrieve the custom fields of a dataset using the DSS Dataset API, for example in your recipe you would have something like this:
import dataiku
client = dataiku.api_client()
project = client.get_project(dataiku.get_custom_variables()["projectKey"])
# Get a dataset handle for the public API, not a dataiku.Dataset object
dataset = project.get_dataset("YOUR_DATASET")
dataset_settings = dataset.get_settings()
custom_fields = dataset_settings.get_raw()["customFields"]
Best,
Harizo
Hi @HarizoR ,
Many thanks for your answer.
How do I missed that, you're right, custom fields are in dataset settings.
Many thanks again.
C.