"Failed to delete data source". Cannot remove postgresql data source

Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

Technical details:

  • Redash Version: 4.0.1.b4038 / 7.0.0.b18042
  • Browser/OS: Firefox/Chrome/Safari Ubuntu 18.04/Mojave
  • How did you install Redash: docker-compose, image: redash:7.0.0.b18042

Hi, I have a problem with removing Postgresql data sources in Redash. In our process, we’re constantly adding/removing whole db’s, so there’s a lot of data sources added/removed to/from Redash on a regular basis.

My problem occurs inconsistently, because it can either happen or not, for the sources coming from the same DB. For example:

There’s 2 datasources pointed to the same endpoint, same authentication (same postgres user/pass), just different db names. Both of them had the same queries and dashboards. Then, I can easily delete one, but not the other (it get’s stuck on deleting process, then error “failed to delete data source” shows up). Sometimes, manually removing (unpublishing, then archiving) all related dashboards/queries help, but that is also inconsistent. For example, right now I am stuck with a datasource that no longer exists (db was purged), no dashboard/query uses it, yet still, I’m unable to remove it from data sources on Redash.

Is there any reason said behaviour is happening? It’s possible I’m doing things in the wrong order, so I’d like to know, what is a “proper” way to remove a data source? Is there a single operation that removed a data source and all related queries/dashboards?

At the moment, the process that works most of the time is:

  1. Downing the DB
  2. Purging aforementioned DB out of existence
  3. Removing data source from Redash
  4. If point 3 fails, then manually remove (unpublish/archive) all related dashboards/queries to said DB and trying point 3 again.
  5. If point 4 fails, get stuck with a data source that isn’t used anywhere and cannot be removed.

Welcome to the forum and thank you for a detailed issue report. One clarifying question: what version of Redash do you run? It says v4 and v7.

it happens both on v4, and currently on v7 (as per listed docker image)

1 Like

to clarify, I’ve checked the behaviour when the problem initially happened on all available browsers/OS listed (Firefox/Chrome/Safari Ubuntu 18.04/Mojave) on v 4.0.1.b4038. Then upgraded the image to 7.0.0.b18042, tried it on all of the same browsers/OS again, and it still didn’t work. As in original post, the one solution to the problem that worked a couple of times already was manually removing dashboards/queries, but this time I just cannot remove the data source, no matter what I’m trying to do. The DB doesn’t exist already, queries and dashboards are unpublished and archived

Can you share a screenshot of the error?

Sure, it appears like this:

SSL mode doesn’t affect the error, it behaves the same way in “disable” and “prefer” setting.

@edit: also, the “Delete” field becomes unclickable after pressing it once and the wheel is ever turning.

Is there any idea what might be the reason for this behaviour? Or could You please respond to the other point of the post: “I’d like to know, what is a “proper” way to remove a data source? Is there a single operation that removed a data source and all related queries/dashboards?”

Do you see this data source in the Redash metadata database? Have you tried to delete the data source with the CLI?

I do not know how to check Redash metadata database, nor the CLI command to remove the data source. I would appreciate pointer or links to Your knowledge base/documentation where I can check it, or could You provide aforementioned command Yourself? I have full access to machine running the containers, so permissions are not an issue for me

I’m wonder if this is the same issue.

Instructions are on the forum here.