Copy Data Models

Just want to firstly do a shout out to all the devs! this is a seriously great product, I have had so much fun using it over the last 2 days, it has just sucked up all my spare and not so spare times! I absolutely adore this product, the idea and the vision. Great job everyone!

My question here is, I have built a simple data model and want to reuse the same data model for a different database. How do I get around to do this?

Thanks.

2 Likes

Not yet!

Is it the exact same data model? And how many databases are we talking about?

If you’ve got 100s (eg, if you do a db-per-customer sort of multitennant application), you can probably do some sql to copy rows in the metabase_field, metabase_table and metabase_database tables with updated database + pks.

I probably wouldn’t do it if you were only going to do 1 or 2 however, as it’ll take a fair bit of time to work out the sql involved.

@sameer yes, its like a multi tenant application and yea there are a lot of DBs with the same structure so I really would like to have a way to rapidly copy the Data Model across. I am still pretty new with Metabase, is there a DB that it connects to for the local Data Storage? Is it the same for the Web Variant as with the Mac client?

Yes, we refer to it as the “application database” in our docs. It is either an embedded H2 database or you can pass in connection details to a MySQL or PostgreSQL database for us to use.

I think for you case, this is the sort of thing you might need to cleanup via ETL if you want to have consolidated analytics across accounts.

I’m :+1: for this feature… we have multiple instances of the identical schema.

I really like the idea that you can bring multiple queries from different databases (say SQLite, MySQL and Postgres) all together with common aggregation keys and plot them in a single graph.

The pain is having to redo the data models for each instance.

Copy Data model from Database A to Database B.

p.s. thanks for an awesome product. I :heart: metabase. (It’s my new Thor’s hammer of BI :slight_smile: )

@Jav @sameer did you ever find a way to do this?

@mjaggard There's several ways to do it, but the built-in functionality is called Serialization (Enterprise Edition):
https://www.metabase.com/docs/latest/enterprise-guide/serialization.html