I’ll need to replace a data source by another, but someone could point me how to find all queries that are using a data source.

I find out.
Access the redash database and perform a query on data_sources table:
select * from data_sources

Find the data source that you are looking for and then lookup in queries table for the queries that are using it:
select * from queries where data_source_id = XX

This can also be done without direct access to the database using the Redash API. I’ll work up an example and post in the next couple days.

1 Like

Just got back to this. The code would look like this.

First, pip install redash-toolbelt and then run:

from redash_toolbelt.client import Redash

URL = '...'
KEY = '...'
DATA_SOURCE_ID = 999

redash = Redash(URL, KEY)

all_queries = redash.paginate(redash.queries)
filtered = [i for i in all_queries if i['data_source_id'] == DATA_SOURCE_ID]

Just fill in the URL for your instance, an admin API key, and the data source ID you want to filter for. You can find that by visiting the data source screen in settings and observing the ID from its URL.