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!
Hello,
I would like to read a JSON file. But with the URL I only access to the first page (the file is paginated). I would like to read ALL the pages.
With Talend I do a loop, but whith JSON I don't know. Can I get help ?
Thank you very much
Hi Sebastien,
By default, recipes will run in "overwrite" mode in DSS. In your python recipe, try navigating to the Inputs/Outputs tab and select the Append instead of overwrite option.
This should allow the results to be appended instead of overwritten in your output dataset. I hope that this helps!
Thanks again,
Andrew
Hi Sebastien,
Could you provide more details about this JSON file and where it's located? Are you using a download recipe or how are you trying to ingest this data into your Flow in DSS?
Thanks,
Andrew
Hello,
Thank you for your answer.
I get the JSON by URL https://porta....
I can only give the end of the url :
e5e3&query_id=735&offset=0 for the first page
e5e3&query_id=735&offset=1 for the second page
etc. There are thousands pages.
I tried a download recipe, but I canโt use ยซ add another source ยป for each page. Too many pages.
Is it possible to do a loop ?
Thank you
Hi Sebastien,
Your best bet might be to create your own code recipe, such as python, where you could handle iterating through the different pages to read in the necessary data, create your own dataframe, and then write this dataframe as an output into a dataset in DSS.
Best,
Andrew
Hi Andrew,
Thank you for your answer. I will use a python recipe without input. I thought that an input was necessary, but it's not.
Thank you,
Best,
Sebastien
Hi Sebastien,
That's correct. For code recipes, only an output is necessary (even if it's a dummy output).
Thanks,
Andrew
Hi Andrew,
I forgot to "accept as solution", but I may have a last question.
Here is my code :
for i in range(5):
url = "https://portail.....................35&offset={0}".format(i)
fileA= pd.read_json(url, orient='records')
loop_issues1.write_from_dataframe(fileA)
The problem is that It replaces everything at each loop. But I want it to add data.
I tried to tell it "mode="a"",but it doesn't understand.
Thank you for your help. I did'nt find nothing about write_from_dataframe on pandas.pydata.org
Hi Sebastien,
By default, recipes will run in "overwrite" mode in DSS. In your python recipe, try navigating to the Inputs/Outputs tab and select the Append instead of overwrite option.
This should allow the results to be appended instead of overwritten in your output dataset. I hope that this helps!
Thanks again,
Andrew
Hi,
I did not see that !! Thank you ! Problem solved
Sebastien