N
N
Neonoviiwolf2018-12-23 10:42:22
PostgreSQL
Neonoviiwolf, 2018-12-23 10:42:22

How to figure out what data to add and what to update in the database?

Kind
Such a question, json data for the android app comes from the server. Some of the data will be new, they need to be added (everything is clear here), but some of the data needs to be updated, i.e. The entry is there, but changes are needed. I get the data by date, i.e. I compare the date of the last entry in the application and send it to the server, the server responds with json data that has been changed / added. Of course, you can search for each row in the application database and if there is no entry, then add it, otherwise update - but this is somehow resource-intensive in my opinion. I use the Room library (ideally the answer for it).
I do not consider a variant with FireBase, does not approach. On the postgresql and flask server, the database application is not a copy of the server database, only the necessary is sent

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2018-12-23
@aol-nnov

You are asking very confusingly.
For example, google "upsert your_orm your_bd"

A
Alexander Sinitsyn, 2018-12-23
@a_u_sinitsin

If the data after the date of the last synchronization of the application has changed / added, then they need to be updated / added for any ... what are the options?
In any case, first you need to check for presence, or try to update immediately, catch the absence exception and make an addition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question