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 @Meirkhan ,
To update the schema of the dataset programmatically you can use Dataiku API. Please refer to the code snippet below (you can run it Python notebook):
import dataiku, json
from dataiku import pandasutils as pdu
import pandas as pd
client = dataiku.api_client()
proj_key = dataiku.default_project_key()
project = client.get_project(proj_key)
dataset = project.get_dataset('dataset_name')
dataset_settings = dataset.get_settings()
dataset_settings.settings["params"]["schema"] = 'new_schema'
dataset_settings.save()
Hope this helps.
Best,
Vitaliy
Hi @Meirkhan ,
To update the schema of the dataset programmatically you can use Dataiku API. Please refer to the code snippet below (you can run it Python notebook):
import dataiku, json
from dataiku import pandasutils as pdu
import pandas as pd
client = dataiku.api_client()
proj_key = dataiku.default_project_key()
project = client.get_project(proj_key)
dataset = project.get_dataset('dataset_name')
dataset_settings = dataset.get_settings()
dataset_settings.settings["params"]["schema"] = 'new_schema'
dataset_settings.save()
Hope this helps.
Best,
Vitaliy
Thanks!
I was trying to do get_settings() before, but it was not working.
Now I get why - I am using dss version 7. And one has to use get_definition() instead.
Do we have an R equivalent of this snippet?
Hi, there is no R equivalent available. However, if you want to stay within the R, you can use "reticulate" to execute python. Here is the full documentation of how you can use "reticulate": https://rstudio.github.io/reticulate/articles/calling_python.html
Best,
Vitaliy
Thanks @VitaliyD !