I am new in using Flask and Peewee tools. However currently I have the following task: Imagine that someone uploads a dataset (in this case an excel file that will be migrated to a pandas df). This dataset will be processed and then stored in a database using peewee and Flask. An id will be matched with his data. But then imagine that the user that uploaded his file wants to delete it, so whenever he tries to access it again it will display that the file no longer exists. However what we want is that the file is still stored in the db but the id belonging to that person gets detached from the file. Also if the person tries to upload a file_2, we don't want that the db returns file_1. Do you have any suggestions in how can I tackle this? I am new using this frameworks and any help/insight would be appreciated
Asked
Active
Viewed 140 times
1 Answers
0
You need to normalize the data. A user table and a separate file table that has a foreign-key to the user who uploaded it. You can implement delete by deleting the row or use a soft-delete, e.g., a column "is_deleted" that you set to True instead of removing the data completely.

coleifer
- 24,887
- 6
- 60
- 75
-
Hi @coleifer, thanks for your response. I was wondering if by chance you have an example of what you mention? I am really new into this and I often get confused in how to perform it without having a similar example. If you do I would be grateful if you could share it – Oliver Oct 13 '19 at 18:55