Hi!
We have ±30 datasources connected to BigQuery, most of them are garbage. But there are questions using them. So to bulk migrate the questions to other datasource, what do I need to do?
Can I simply update database_id on report_card? Like:
UPDATE report_card
SET database_id = 53
WHERE id IN (questions to be migrated)
Hi @fredericohorst
Only if the questions are SQL - and doesn’t have any filters with field references.
Otherwise you’ll have to look at metabase_field/table/database
and make sure everything is linked up correctly - that’s a really big task, so it’s probably easier just to manually create the questions that are needed again.
Make sure that you have backups before editing anything in the application database - it’s quite easy to end up with a corrupted database (and those problems will likely not show up right away).
1 Like
Hey, thanks @flamber
Most of them are SQL, so for them it won’t be a problem.
For the MQL (or not SQL) ones, what is that table? I took a brief look in it, but it is still a bit blurry for me. Because even most of the questions being SQL, still have up to 200 on MQL, so… ¯_(ツ)_/¯
@fredericohorst MBQL is Metabase Query Language, the code generated when using Simple/Custom questions. It’s not going to be easy, but you would have to update all field references, so they link to your active DB - metabase_field
, _table, _database.
1 Like
just a quick update here: I’ve updated the db to most of my MBQL queries and it was really a big task - as expected, considering the previous comments. If anyone reading this, consider doing this type of migration only if really needed.
To do so, it was needed to:
1- recreate segments and metrics for the new db.
2- create a dictionary to which segment/metric on db1 was which segment/metric on db2.
3- query metabase_field and metabase_tables to do the same of 2 but for the fields and tables.
Doing so, it was possible to migrate about 92% of the questions without errors.
1 Like