Is there any way to copy database within Metabase?

Hi all,

I'm looking for a solution for my specific case.
I got a client that has got 9 postgresql databases. Those 9 database have the exact same database layout (tables/fields etc), only offcourse, with different data inside.

I'm looking for a way to bring them all into 1 metabase instance. But i also do translations in metabase, hide columns, make foreign key links etc... it would take me ages if I have to do that 9 times.

Isn't there a way to copy databases in metabase?

Hi @cobalt
That's one of the things that Serialization is able to help with:
Otherwise you would need to do it manually in the application database and making sure to make the correct references.

Seems a bit like mission impossible i'm afraid.
Serialization is not an option for us (price & complexity).

Was already looking into the database. I asume i would need metabase_database/field/fieldvalues/table.
But that seems to be impossible to copy those like 9 times, and then make sure the 'linkings' are correct.

@cobalt It's definitely not easy to do it appdb, but it is possible - though depending on the size of your database and how many times you need to do it, then it might be easier to just do it manually.
It would require some fair amount of sub-queries that lookup on the "master" database to understand which tables and columns are linked, and then it would find the correct ID for that on each "child" database, so it can set the correct reference.

But a lot of work went into Serialization to allow various types of migrations, and also the reason why it's part of the Enterprise Edition.

One note though, manually changing the appdb is a great way to end up with corruptions, so be careful.

You don't want to look at metabase_fieldvalues in your case, since the data is different, so you don't want to copy that.

Ok thanks for the tip.
Just one question, if you rename a 'column', is the original name still saved somewhere in the database or not?
I was thinking of first adding the databases through metabase and then overwriting some column values based on a record from other database instance. But then offcourse i need the original column name to compare.

@cobalt If Metabase has synced your database, and you then go and rename a table or column, then Metabase will create a new table/field reference and set the old reference to active=false