reload dataset schema programmatically
fmonari
Registered Posts: 18 ✭✭✭✭
Hi All,
is it possible to reload a s3 dataset schema programmatically through the usage of the dataikuapi package? Thanks in advance!
Regards,
Filippo
Answers
-
Keiji Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 52 Dataiker
Hello @fmonari
,Thank you so much for posting the question on Community.
Yes, you can reload a dataset's schema via Dataiku Python API as follows:
import dataiku client = dataiku.api_client() project = client.get_default_project() dataset = project.get_dataset('your_dataset_name') # `autodetect_settings` will however only detect if the schema is empty, so let's clear it. settings = dataset.get_settings() del settings.schema_columns[:] settings.save() # Redetect and save the suggestion. settings = dataset.autodetect_settings() settings.save()
Please see this DSS document https://doc.dataiku.com/dss/8.0/python-api/datasets-other.html#sql-dataset-modifying-settings for the details.
I hope this would help.
Sincerely,
Keiji, Dataiku Technical Support -
Thanks KeijiY I will try it out!