metabase_api_python icon indicating copy to clipboard operation
metabase_api_python copied to clipboard

Fixing copy_dashboard for Metabase hosted in Heroku

Open CesarVigario opened this issue 2 years ago • 6 comments

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.

CesarVigario avatar Nov 03 '22 14:11 CesarVigario

Hi @CesarVigario, thanks for the contribution. I'll review it soon.

vvaezian avatar Nov 03 '22 15:11 vvaezian

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.

vvaezian avatar Nov 05 '22 18:11 vvaezian

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.

cesar-vigario-knok avatar Nov 07 '22 10:11 cesar-vigario-knok

This PR is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Dec 08 '22 02:12 github-actions[bot]

This PR was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Dec 23 '22 02:12 github-actions[bot]

Keeping this open. The proposed solution is too ad-hoc. Need a more general approach.

vvaezian avatar Dec 23 '22 02:12 vvaezian