Metabase Metadata SQL

Hey everyone, I am trying to figure out if it is possible to query for all questions and dashboards that weren't visited in the past few months. Is it possible to do this in the application database?

That's already been answered earlier in this thread.

Got it, thank you!

Hi, I am new to application db. May I know, running_time in query_execution falls under what time format? seconds?

image

@mamzarmr Look at the column descriptions, they are available for most tables and columns.
Specifically query_execution.running_time: The time, in milliseconds, this query took to complete.

1 Like

Thank you for sharing your queries! It was really helpful:)
Additionally I need to show dashboards which appear at the main page of our company metabase page. This dashboards are pinned in our collection Our analytics. Maybe you know where to find pinned dashboards in metabase logs?

Agreed super helpful

  • List of un archived dashboards with last accessed date on the public link
-- using view log table see when cards were last accessed and map the card ids to dashboard ids. 
-- (none of my cards are on more than one dash)
with joined as (
    select 
        view_log.model_id as Model_ID,
        date(max(view_log.timestamp)) as Last_Viewed,
        report_dashboardcard.dashboard_id as Dashboard_ID 
    from
        view_log 
        left join report_dashboardcard on view_log.model_id = report_dashboardcard.card_id 
    where 
        view_log.model = 'card'
        and view_log.user_id is null
    group by 
        Model_ID, 
        Dashboard_ID
),

-- get rid of dashboards that are archived
dashboards as (
    select 
        report_dashboard.id as Dashboard_ID,
        report_dashboard.name as Dashboard_Name
    from 
        report_dashboard
    where
        report_dashboard.archived = false
)

-- join two above tables to link dashboard name to dashboard id
select 
    dashboards.dashboard_name as Dashboard_Name,
    max(joined.last_viewed) as last_viewed 
from 
    joined 
    inner join dashboards on joined.dashboard_id = dashboards.dashboard_id
group by 
    Dashboard_Name
order by 
    last_viewed desc
1 Like

Hi, I'm struggling to find the Metabase application credentials. Could someone point me to the right direction? I have admin rights.

You need to migrate to Postgres or MySQL

Later update. Found it, thank you!