metabase_api_python
metabase_api_python copied to clipboard
Fixing copy_dashboard for Metabase hosted in Heroku
When the dashboard contains too many cards/questions, the function copy_dashboard fails.
What happens is: the variable "res" does not return a json and therefore the variable "dup_dashboard_id" raises a TypeError. Despite of "res" returns false, the dashboard was indeed created in Metabase.
Therefore, if we could obtain the "dup_dashboard_id", we could move on inside the function and do a deep_copy.
The solution I found was to get all dashboards and pick the last one we created and select the id.
Hi @CesarVigario, thanks for the contribution. I'll review it soon.
I believe the root cause of the issue needs to be explored further. Maybe there is a simpler and more general solution to the issue. You mentioned
When the dashboard contains too many cards/questions, the function copy_dashboard fails.
Have you found a threshold that if the number of cards is more than that threshold then the dashboard copy task fails? I need to reproduce the issue first.
Hello @vvaezian , I agree that a simpler solution can be found.
Regarding the threshold, in my case, it is 24 cards. However, I'm using a hosted Metabase in Heroku, and therefore this threshold may change, depending on the number of dynos.
Remembering that, despite of the empty response when doing a post, the dashboard was in fact created. That's why I could pick the dashboard id and do a deep copy. I think this issue is caused by the Metabase API itself, not by your code.
This PR is stale because it has been open for 30 days with no activity.
This PR was closed because it has been inactive for 14 days since being marked as stale.
Keeping this open. The proposed solution is too ad-hoc. Need a more general approach.