5 Replies - 342 Views - Last Post: 14 March 2019 - 02:40 PM Rate Topic: -----

#1 masterori   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 27-January 14

How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 01:05 PM

This is probably a software design question, but I'm using python and flask, so I hope this is the right place.

But I have a use case:

User uploads a data file whose data will be saved to the db and displayed in a table.

While the file is uploading, the user can make manual changes to the already existing data in the table

What's the usual design to prevent discrepancies here? Should the table be locked and un-editable while the file is being uploaded and saved to db. Or allow edit, but somehow save the edits and after file upload finishes then process those edits?

To know when the file finishes and it's good to allow editing of the table, then there needs to be some sort of id. This means something like celery - but can this be done without celery (and similar)?

Is This A Good Question/Topic? 0
  • +

Replies To: How to handle file uploads and manual edits of data at the same time?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14925
  • View blog
  • Posts: 59,590
  • Joined: 12-June 08

Re: How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 01:14 PM

Are they editing the info that is coming in, or random rows aside from teh upload?
Was This Post Helpful? 0
  • +
  • -

#3 masterori   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 27-January 14

Re: How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 01:22 PM

View Postmodi123_1, on 14 March 2019 - 01:14 PM, said:

Are they editing the info that is coming in, or random rows aside from teh upload?

Both. The file upload can update an existing data row, which the user can also edit before the file upload finishes. So in this case, there'd be two values to choose from when updating the database, one from the file and one from the user.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14925
  • View blog
  • Posts: 59,590
  • Joined: 12-June 08

Re: How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 01:32 PM

Oh, in that case - no. Let the file upload happen first... then allow editing to happen. Make it a set order of operations.
Was This Post Helpful? 0
  • +
  • -

#5 masterori   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 27-January 14

Re: How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 02:05 PM

Is it possible to not use celery (or anything like it) and just built-in python features to get an id of the upload task? I looked at the concurrent futures/threadpoolexecutor but there doesn't seem to be a function that returns an id
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14925
  • View blog
  • Posts: 59,590
  • Joined: 12-June 08

Re: How to handle file uploads and manual edits of data at the same time?

Posted 14 March 2019 - 02:40 PM

Not sure about 'celery'.. it would depend on how your whole app is setup.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1