Want to Stop Rebuilding "Expensive" Parts of your Flow? Explicit Builds are the Answer!READ MORE

Are there any ways with Python to create a loop to read files all in a zip file?

chrishnet997
Level 2
Are there any ways with Python to create a loop to read files all in a zip file?

Im trying to create a loop in Dataiku using a loop fuction to read files all in the same zip, but is there a way to read the files without writing the names static ly ? 

How would that work? Maybe assigning each file to a different variable? But do i have to write the file name this way? Or the loop will assign the variable with each file they read? 

 

Thank you any help/comment is greatly appreciated 

0 Kudos
2 Replies
tgb417
Neuron
Neuron

@chrishnet997 ,

Welcome to the Dataiku community.

There are some built in ways to deal with ziped files as if they were unzipped, data sources.  This is a really cool feature that might help in your case.  This talks about the subject.

https://community.dataiku.com/t5/Using-Dataiku/How-to-automatically-uncompress-files-in-a-download-r...

In a python recipient Dataiku can give you all of the files in a managed folder or directory.  You might find these conversations useful in what you are trying to do.

https://community.dataiku.com/t5/Using-Dataiku/SFTP-Site-with-Zip-files-with-more-than-just-data-in-...

here is some doc on working with managed folders

https://doc.dataiku.com/dss/latest/python-api/managed_folders.html?highlight=managed%20folder#module... 


let us know if this is of help and how you are getting along with your project.

 

--Tom
0 Kudos
chrishnet997
Level 2
Author

So the first step would be to import the file as a zip (simple import) and the second in python i can unzip it and assign variables to each file. Would that work? 

0 Kudos

Labels

?
Labels (1)

Setup info

?
A banner prompting to get Dataiku