vvaezian / metabase_api_python

A python wrapper for Metabase API
MIT License
131 stars 39 forks source link

Fixing copy_dashboard for Metabase hosted in Heroku #38

Open CesarVigario opened 1 year ago

CesarVigario commented 1 year ago

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.

vvaezian commented 1 year ago

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

vvaezian commented 1 year ago

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.

cesar-vigario-knok commented 1 year ago

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.

github-actions[bot] commented 1 year ago

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

github-actions[bot] commented 1 year ago

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

vvaezian commented 1 year ago

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