I want to change a column name in a source table without breaking the questions that depend on it. I was considering the following approach:
-
Stop the DB sync in Metabase Admin Settings
-
Change the column name in my database.
-
Update the column name
in the metabase_field
table.
-
Restart the DB sync.
Will this approach work without causing issues in Metabase? Are there any potential pitfalls or additional steps I should be aware of?
Thanks in advance for your help!
Anyone knows how to Change Column Name in Source Table Without Breaking underlying Questions in Metabase ?
Hello,, did you try and meet any drawbacks? We are considering the same technique.
Hello
What I did is:
- 1 / change the name of my column
- 2/ save the field_id of the old and of the new column name in the metabase_field table
- 3/ delete the row with the old column name in the metabase_field table (using the pre saved id)
DELETE FROM metabase_field WHERE id = old_column_id;
- 4/ update the row with the new_column_name and replace its id with the id of the old_column_name row I have just deleted
UPDATE metabase_field SET id = old_column_id WHERE name = 'new_column_name' AND table_id=table_id
It seems to work fine and does not break Metabase dashboards using the old column name