Dashboard specific Caching

*query_mbd() queries the metabase database :slight_smile:

Thanks a lot @theo !!! very appreciate it, a quick question I see you remove cache from query_cache table, but I don't have this table, I only see query and query_execution tables, should I use query table instead?

and * query_mbd() uses REST API as well?
something like this

def query_mbdb(query):
    query = """delete 
                  from public.query_cache
                 where query_hash in (select hash 
                                      from public.query_execution 
                                      where card_id=""" + str(card_id) + ")"
    url = '.../api/dataset/'
    headers = {'Content-Type': 'application/x-www-form-urlencoded', 'X-Metabase-Session': '.....'}
    payload =  {database: 1,
                         native: {query: f"{query}"},
                         type: "native"}
    r = requests.get(url, headers=headers, json= payload)

Everybody has the query_cache table. Otherwise your application database is corrupted.
The queries inside of query_mbdb() are direct database calls to the application database. It's not API calls.

Thanks @flamber!!! it worked.

Hi @theo, have you noticed that some cached dashboards don't use cache and try to call the db? I have 10 cached dashboards and get randomly one or two not using cache.