How to synchronize local SQL database with a server to provide it to mobile or other devices?

137 Views Asked by At

I've created a software (in Python), which is tracking time of my projects I am working on. This software is generally on my PC, but now I have a copy on my laptop, too.

The problem is, I can't get them in sync, but I wish to have a server, which will have all data and that a client can get the deltas. But how does this work? I have no idea what I have to do on a server, because I most likely code on the client side.

  • Should the server receive only the new data as JSONs?
  • How does a client know, which data was already requested to avoid overhead?
  • Which programming language can be used (e.g. Python) to have a secure back-end?
  • Can it be used for future apps on mobile or websites, too?
  • If other software is involved, it should be open source and it should be for Linux (not Windows)

I know that it might have something to do with creating my own REST API, but how? What are modern frameworks/languages for it?

I am thankful for any tip, which nudges me in the right direction :)

1

There are 1 best solutions below

0
Daviid On

This software is generally on my PC, but now I have a copy on my laptop, too. The problem is, I can't get them in sync

How does the software store the data? File? sqlite DB?

Should the server receive only the new data as JSONs?

Depends on how you build the tracking software and the server, if the server accepts connections directly to database (e.g. a MySQL server with open ports) you could just have your software connect to it and read/write directly, or you could also create a REST API that you call when you want to read/write to the DB.

How does a client know, which data was already requested to avoid overhead?

Timestamps or primary key IDs, this also depends on how you build the software/DB, if you have something like a table tracking with a single column time which has 1 row per project and that's it then you don't need to keep track of any requests, just update the column if your value is higher than the current stored value.

Which programming language can be used (e.g. Python) to have a secure back-end?

This is up to you and what you're familiar with. (As for security, even the most secure oriented language can be as insecure as a door locked with a seweing thread if configured incorrectly)

Can it be used for future apps on mobile or websites, too?

Don't understand this question but yes.

If other software is involved, it should be open source and it should be for Linux (not Windows)

Also yes.