How to change multiple questions at once?

Let’s say, for example, that I want to change the table name and schema of a psql database connected to my Metabase.
There are hundreds of different questions that use this table reference name.
How can i change all at once? Can i just replace the table schema_old.table_old with the new schema and table name on the query table on the internal metabase database?
Would it work?

Thanks

Hi @luccazen
If it is Native questions, then you might be able to change report_card without any major problems.
If they are Simple/Custom questions, then you won’t be able to do that and it would require much more work to try to do that, because the tables are referenced as IDs in metabase_table
Make sure you have backups before trying to change anything in the metadata.

awesome! thanks!
anyway to update the tables filters reference as well?

@luccazen There’s no table reference in report_card if you’re using Native query.

sorry, I was not clear. What i meant was: Can I update the table filters as well? I need to change the whole dashboard filters source table.

@luccazen You can update everything you want - it’s not easy, let me make that clear.
You need to look in metabase_database, metabase_table, metabase_field and report_card, report_dashboard, report_dashboard_card.
There’s references in several columns, and they all need to be correct otherwise you’ll corrupt the data.

perfect, thanks. With that information, I think it might be safer to only change the questions source table. In that case, only the report_card is enough to be updated, right?

@luccazen You still haven’t answered if it is a Native/SQL question or Simple/Custom question. If Native, then you’re just changing the query, there’s no references in other column other than the database (and sometimes schema depending on database type).

sorry, it’s native query

Hi here,
Sorry to resurrect a zombie thread.

We were facing the same problem recently for a customer who was migrating their data model to new schemas/tables.

We come up with a small cli tool who can migrate references to tables in Metabase questions/cards and dashboards. It's provided as-is, but we will be happy to know that this helped someone else.

Here is the git repo: GitHub - untitled-data-company/metabase-migrate-table: A cli tool to replace table references in Metabase questions or dashbaords