Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposure Extraction Error | In Case of Missing Cards in collection #237

Closed
dosnep opened this issue Feb 28, 2024 · 3 comments · Fixed by #238
Closed

Exposure Extraction Error | In Case of Missing Cards in collection #237

dosnep opened this issue Feb 28, 2024 · 3 comments · Fixed by #238

Comments

@dosnep
Copy link
Contributor

dosnep commented Feb 28, 2024

Context:

When I use Metabase API to delete archived cards, it creates inconsistency because card are still referenced in collections.
So at this step, it's possible to search a deleted card/dashboard causing an HTTP code 400 error and makes application crash.

Problem

In case of inconsistency between collections and cards/dashboards, dbt-metabase will crash because it tries to query a missing card/dashboard.

Request

Skip a card/dashboard which is referenced in a collection but has been deleted.

Technical Solution

Test for each items in a Collection if the associated resource is reachable otherwise continue to the next item.
We could add a try&catch statement for get_dashboard and get_card as we did here

Note

Event if it's not the purpose of that tool, it could be interresting to highlight inconsistency with the logger in case of unreachable item resource.

@gouline
Copy link
Owner

gouline commented Feb 28, 2024

I'm surprised Metabase still lists deleted cards and dashboards. Does this happen on the latest version? If so, should this be reported to Metabase as a bug too?

@gouline gouline added the bug Something isn't working label Feb 28, 2024
@dosnep
Copy link
Contributor Author

dosnep commented Mar 4, 2024

I'm working with an old version (0.45.4.3). Certainly, we should consider upgrading to the latest version. I'll make an effort to work on that and keep you updated. Additionally, I attempted to directly search the database for a table storing the mapping between collection_id and card_id (with a delete cascade configuration on the card table for the card_id primary key), but I couldn't find such a table. It seems that this logic is directly managed by the application for consistency as well.

@gouline gouline removed the bug Something isn't working label Mar 4, 2024
@gouline
Copy link
Owner

gouline commented Mar 4, 2024

Assuming you're deleting cards with DELETE /api/card/:id:

DEPRECATED – don’t delete a Card anymore – archive it instead.

You can finish #238 for extra safety, but I'm closing the issue as invalid, because this is unsupported by Metabase.

@gouline gouline closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants