node-gtfs icon indicating copy to clipboard operation
node-gtfs copied to clipboard

Deleting the db to avoid id collisions

Open laem opened this issue 1 year ago • 3 comments

Hi, I was confronted with a weird problem : while analysing routes for their frequency, I got strange results : a suppposedly school bus was apparently running on sundays.

Turns out, it was a db update problem : the GTFS I was loading every day was updated reusing serviceIds that were used by totally different routes.

My simple solution is to delete the DB. Maybe this could be a feature ?

Right now, I'm calling the DB "2024-05-12-11-14" (day hour minutes) and removing them after a successful update.

laem avatar May 12 '24 09:05 laem

If you leave the config sqlitePath empty, an in memory database will be used. This will be deleted as soon as the process is complete.

Would that solve the problem you describe?

On Sun, May 12, 2024 at 02:14 Mael @.***> wrote:

Hi, I was confronted with a weird problem : while analysing routes for their frequency, I got strange results : a suppposedly school bus was apparently running on sundays.

Turns out, it was a db update problem : the GTFS I was loading every day was updated reusing serviceIds that were used by totally different routes.

My simple solution is to delete the DB. Maybe this could be a feature ?

Right now, I'm calling the DB "2024-05-12-11-14" (day hour minutes) and removing them after a successful update.

— Reply to this email directly, view it on GitHub https://github.com/BlinkTagInc/node-gtfs/issues/161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXPWKBEVKMOED3DVLZR6TZB4XHLAVCNFSM6AAAAABHSUYLCSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TCMRUGY3TQOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

brendannee avatar May 12 '24 15:05 brendannee

Not really, because I want to store the database in the filesystem to avoid reparsing the GTFS if the server crashes (or in dev mode, when I restart my server after a change).

laem avatar May 12 '24 15:05 laem

Check out the latest version https://github.com/BlinkTagInc/node-gtfs/releases/tag/4.10.3 - I added a deleteDb method: https://github.com/BlinkTagInc/node-gtfs?tab=readme-ov-file#deleting-a-database

Let me know if this doesn't work for your use case.

brendannee avatar May 13 '24 06:05 brendannee