Can't delete data source

I am using version 7 and for some of the data source, I can’t delete them. It keeps trying.

Possibly this bug?

1 Like

This is how I solved it as I was faced with the same issue (I ran this in redash v10)

-- grab first the data source ID from data_sources example: 25
-- In order to delete a data source 
-- First, you need to remove all Query Results that are attached to that data source
update queries
set latest_query_data_id = null
where latest_query_data_id in (
select id
from query_results 
where data_source_id = 25)

delete from query_results where data_source_id = 25

-- Second, you need to remove the data source tables from the schema tables 
delete from data_source_columns
where table_id in (
select id from data_source_tables where datasource_id = 25
)

delete from data_source_tables where datasource_id = 25
commit

@jesse and team if the above is wrong or if there is a better way. Please let me know

Thank you
Ramzi

Hey @ramziyassine thanks for sharing your code.

The first part of your SQL works fine. But where are you seeing a data_source_columns table? I don’t see this on V10

we ran the upgrade using the management script (our database was a v5 database but we upgraded) is this table not needed anymore? How does redash v5 store the schema information?

1 Like

Schemas are stored in redis.