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!
How can we pick files with dynamic filename using sharepoint plugin? For ex- filename will contain date value and hence will change everyday.
Hello,
If you want to dynamically update the sharepoint filenames automatically, you can use a combination of custom variables in DSS and the python API for inside scenarios.
First, set up a custom variable in your plugin config field. You can call it ${filename}.
Next, we'll want to dynamically update this variable regularly. To do so, go to scenarios --> +new scenario (or open up an existing scenario) --> steps --> add step --> execute python code, and paste something like the below in the code box.
import dataiku
from dataiku.scenario import Scenario
import datetime
today = datetime.date.today()
filename = 'dataset_{}-{}-{}.csv'.format(today.year, today.month, today.day)
scenario = Scenario()
scenario.set_project_variables(dataiku.default_project_key(), filename = filename)
Now, your project variable will get updated with the current date every time you run the scenario.
Next, you'll want to automatically rebuild the sharepoint dataset, so just add a build/train step, select the dataset you want to rebuild, and set build mode to force-rebuild.
You can then set triggers to run this scenario daily, weekly etc.
Let me know if you have any additional questions!
Best,
Katie