This script allows you to transfer a collection from one Metabase instance to another, including cards (questions) and dashboards.
-
Install dependencies
Ensure you haverequestsinstalled:pip install requests
-
Run the script
Execute the script and provide the required inputs:python metabase-mover.py
-
Required Inputs
- Source Metabase URL (SOURCE_METABASE_URL)
- Target Metabase URL (TARGET_METABASE_URL)
- Source Session Token (SOURCE_SESSION_TOKEN)
- Target Session Token (TARGET_SESSION_TOKEN)
- Collection ID to transfer (COLLECTION_ID)
- New collection name in the target Metabase (NEW_COLLECTION_NAME)
The script uses the Metabase API to retrieve collection details from the source instance.
A new collection is created in the target Metabase instance.
All cards (questions) within the collection are fetched and transferred to the target Metabase.
Dashboards associated with the collection are identified and transferred.
The new dashboards are updated to reference the newly created cards.
All dashboard filters are also transferred to maintain dashboard functionality.
- Session Token Issues: Ensure that session tokens are valid.
- Cards or Dashboards Not Transferred: Verify that the collection contains items and that you have sufficient API permissions.
- Dashboard Filter Transfer Issues: Sometimes, Metabase requires that dashboards be created first, and then filters should be updated separately.