Python Recipe Read Empty Dataset

tmgiang
Level 2
Python Recipe Read Empty Dataset

I create a recipe by Python to read data from postgres database. To avoid read old data many times, I create a history table and store like dataset. So in the code I read the history before run the query.



run_history = dataiku.Dataset("history_run_working_details")

run_history_df = run_history.get_dataframe()



The problem that the history is empty in the first running. How can I handle this exception? (currently I temporary upload a history csv file before run the first time)



 

0 Kudos
2 Replies
jereze
Community Manager
Community Manager

Hi,



Maybe you can find a method on the dataiku.Dataset() class that can help you?

https://doc.dataiku.com/dss/latest/api/python/datasets.html

Jeremy, Product Manager at Dataiku
0 Kudos
tmgiang
Level 2
Author
I was looking in that pages before ask the question here :). The problem can not solve because dataiku.Dataset() does not return empty set ๐Ÿ™‚

I deal with this issue by using try-catch

Labels

?
Labels (3)
A banner prompting to get Dataiku