metabase_api_python icon indicating copy to clipboard operation
metabase_api_python copied to clipboard

Changing the database with the clone_card function

Open PatrickRoethlisberger opened this issue 3 years ago • 4 comments

I'd love to be able changing the underlying database with the clone_card function. The Use case I've got in mind is having multiple environments which all have the same question/card but different databases.

I've imagined something like this:

mb.clone_card(card_id=2, source_table_id=16, target_table_id=69, target_database_id=1 ,new_card_name='Cloned Card', new_card_collection_id=6, new_database_id=2, ignore_these_filters=[])

As far as I can tell, only the database_id as well as the dataset_query.database properties of the card have to be changed.

PatrickRoethlisberger avatar May 10 '22 09:05 PatrickRoethlisberger

Hi @PatrickRoethlisberger, thanks for the feedback. I will work on this when I get some time. In the meantime please feel free to open a PR.

vvaezian avatar May 10 '22 15:05 vvaezian

Hi @vvaezian I have a similar use case to the OP. Did you get a chance to work on this or is a PR still welcome?

rparrapy avatar Jan 10 '23 12:01 rparrapy

Hi @rparrapy, not yet. Feel free to take a stab at it.

vvaezian avatar Jan 10 '23 17:01 vvaezian