Freika / dawarich

Self-hosted alternative to Google Location History (Google Maps Timeline)
https://dawarich.app
GNU Affero General Public License v3.0
2.23k stars 51 forks source link

Is import data idempotent? #396

Closed alangrafu closed 1 week ago

alangrafu commented 1 week ago

I wonder if I import a .rec file twice I will get duplicates? What if I import an updated version?

I'm asking because while I'm just testing dawarich and looks super cool, I don't want to remove my owntracks server, at least not until there is a more stable version. Thus, I would like to import (via cronjob ideally, manually otherwise) the .rec files every day, but every .rec file corresponds to a month, so I will be importing the same points over and over again.

Is that possible? Thanks!

Freika commented 1 week ago

Every point about to be recorded to the database is checked for uniqueness based on latitude, longitude, timestamp, and user_id. If you import a new file, all points will be imported. Only the new points will be imported if you import an updated version of the same file.

The downside of it is that all raw content of the files that are being imported via the web interface are being stored in the importa.raw_data column of the database, so having several slightly different files imported will take unnecessary place in the DB.

Otherwise you're good to go :)

alangrafu commented 1 week ago

Thanks!