Reputation: 85
I have an App that have endpoint which receives large .csv file, that need to be parsed, validated, and each row in this file is going to be inserted in database. Because file is too large for immediate response to the user, i just send message back telling that "file in the queue for processing". What is the best tool in my case for inserting 10 to 100k rows in database (postgresql) in the background and be able to get some report if it is succeeded or not? How would whole life cycle of uploading such file would look like?
Upvotes: 0
Views: 1075
Reputation: 3605
Independend from which tool/s you gonna use specifically for this job I would suggest a lifecycle like the following.
User uploads file to the server, once the file is stored you can safely end the request, along telling the user the file has been uploaded sucessfully and is now being processed. Now it probably depends on the database, but IMHO I wouldn't store a file buffer directly in the database. I would simply store the file on a file storage and only save a reference to the file in the database. I do this with all files in general.
Now on the server there are some sort of processing queues (I say sort of, because there are many possibilities out there). From the top of my head I would suggest 3 processing queues. For now let's not think about the "progress update / report" part.
- Queue A : File parsing, validating
- Queue B : File reading
- Queue C : Database storing
Let's asume this is all controlled by the user via a frontend web app.
Upvotes: 1