Copying questions in report_card table

Whats the proper way to copy questions in metabase in the report_card table? If I just copy the rows and change the pkey, next time I try to save a question in the UI I run into primary key duplication issues. Do I need to reindex the report_card table? Is there anything else I need to do to have this work properly? Using postgres backend.

Hi @madkap
The “proper way” is to use Serialization (available in the Enterprise Edition), or the API, but definitely not directly editing the application database (it’s an easy way to lead to corruption) :wink:
There are some third-party scripts as well like https://github.com/elevate/elevate.metabase.tools

Thanks for the info @flamber, just want to double check to make sure we’re on the same page here. I am not trying to copy questions from one database to another. I have about 25 questions in metabase where I want to make exact copies of the question, but save them in a different collection. I need to do this ~4x so I want to avoid manually editing and re-saving questions in a new collection 100x. Is there a better way to do this?

@madkap Okay, so while you can use what I said above, you’re looking for this:
https://github.com/metabase/metabase/issues/4483 - upvote by clicking :+1: on the first post
And @King_Edward has created an awesome little script, so check that out:
https://github.com/vvaezian/metabase_api_python

That script looks like it will work, thank you very much.

@madkap It’s not me you should thank, but @King_Edward :wink:

Thank you @King_Edward for making this, but thanks @flamber as well for pointing me towards it since I don’t think I would have ever found that on my own :wink:

1 Like