How to assign input file name to a variable dynamically in python recipe
NilamberPanda
Partner, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 9 Partner
Hi,
I am creating a flow where a User will upload csv files everytime they use my flow. I want to dynamically store this filename in a variable and use in my python code. How can I store the filename dynamically in a variable ?
Operating system used: Windows
Tagged:
Answers
-
Hi,
if "upload" in this context means "upload in a UploadedFiles dataset", then you can get the names of the files in such a dataset with a few lines of python
import dataiku ds = dataiku.Dataset('the_name_of_the_dataset') file_paths = [p['path'] for p in ds.get_files_info()['globalPaths']]
and file_paths will be the '/'-prefixed list of names of files in the dataset