merging two teslamate databases #1172
Replies: 2 comments 1 reply
-
I'm in a similar situation and where I would want to merge my two old TeslaMate databases (which I took a backup ofc) in to one single database. I made the mistake that I created a new TeslaMate instance for every new Tesla we got but now lacking the ability to get a comprehensive view on historic data of the other models. I've got access via psql / pgAdmin to the DB instance and tried to do a restore but obviously running in to issues as the keys are already existing. And DB expert out there? :) |
Beta Was this translation helpful? Give feedback.
-
it is possible, if you are able to write your own sql lines. If you are not, it is not possible, because I doubt that anyone would write a migration script specifically for you. Both cases require different migration scripts. The first one seems to be quite straight forward, since you just have to restore the second database under a different name. then select on all tables in the second database and input all raw data into first database within the timeframe you want to have it (it obviously is a bit more, but you get the picture). The second one is more complex, since you have two cars with id#1 in each database, which are to be merged to carid#1 and #2. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have two postgres database of different instance of Teslamate.
One from time_1 to time_3 and another one from time_2 to time_4.
Would it be possible to import from first database between time_1 and time_2 into second database ?
I think it would be easy to do I was able to convert data from first Teslamate database into TeslaFi format ( https://github.com/adriankumpf/teslamate/tree/master/test/fixtures/import/01_complete ), manually remove data between time_2 and time_3 and then use the import system that's present inside Teslamate.
I tried to build that export out of a SQL query but it does not look so easy.
Is there any easy way I missed to do this ?
Best regards,
A.
Beta Was this translation helpful? Give feedback.
All reactions