simonw / db-to-sqlite

CLI tool for exporting tables or queries from any SQL database to a SQLite file
Apache License 2.0
368 stars 28 forks source link

ValueError #54

Open jhoogeboom opened 5 months ago

jhoogeboom commented 5 months ago

I'm trying to back up a postgres db to sqlite, but running in to this issue:

ValueError: year 275760 is out of range

This database has a expires_at which is set to 'never', which in this has it just set very far into the future so far that Python cannot deal with it:

COPY omnivore.api_key (id, user_id, name, key, scopes, expires_at, created_at, used_at) FROM stdin;
9702de10-f681-11ee-a194-87a8719f2d3d    deee6128-f25c-11ee-991f-df4a5f9dc67c    Test    82eb3b1c190d7b1c3163aa2387ce67c8310c7e1b554259ac68825a43c00bc1cf    {}  275760-09-13 00:00:00+00    2024-04-09 14:58:13.943123+00   \N

Since I'm selfhosting this software I'm just going to patch the never date with a date like 01-01-9999 that makes sense in python as a workaround. Any idea on how to deal with these kind of errors as a user more generally when using db-to-sqlite? Is there any way to handle errors?