dimanche 19 juillet 2015

A command-line/API tool for tracking history of tables in a database, does it exist or should I go and develop one?

I am currently working on a project where I need to do databases synchronization. We have a main database on a server and a webapp on it to interact with the data. But since this data is geographic (complex polygons and some points), it is more convenient and more efficient for the users to have a local database when working on the polygons (we use QGIS), and then upload the changes in the server. But while an user was working locally, it is possible that some points were modified in the server (it is only possible to interact with the points on the server). This is why I need the ability to synchronize the databases.

Having an history of INSERT, UPDATE and DELETE of the points on the local database and the same on the server database should be enough to reconstruct a history of the points and then synchronize.

By the way, we use Spatialite for local databases and PostGIS for the server main database

I found a bunch of resources on how to do this using triggers on databases:

http://ift.tt/1gISw1d

How to Store Historical Data

...

But I could not find any tool or library for doing this without having to manually write the triggers. For my needs I could absolutely do it manually, but I feel like it is also something that could be made easier and more convenient with a dedicated command-line/API tool. The tool would for instance generate history tables and triggers for the tables where the user want to track an history, and we could also imagine different options such as:

  • Which columns do we want to track?
  • Do we only want to track the actions, or also the values?
  • ...

So, to conclude, my questions are:

  • Is there any existing tool doing this? I searched and found nothing.
  • Do you think it would be feasible/relevant to implement a such tool? I was thinking in doing it in Python (since my project is Django-powered), enable different backends (right now I need SQLite/Spatialite and PostgreSQL/PostGIS)...

Thank's for your answers,

Dim'

Aucun commentaire:

Enregistrer un commentaire