Hello, looking for a way to search the text of all SQL queries across collections.
In the app DB, the report_card table contains the question definitions. The dataset_query column contains the SQL query in a JSON object under native → query. That should be enough to write a query to search.
You can add the app DB to Metabase so you can explore Metabase’s app state with Metabase.
Be careful with exposing the app db though, it shows everything including user data, so restrict access to people you trust.
Hey @matthew.hofmann,
@dwhitemv's report_card.dataset_query approach works well, that's basically what most search tools do under the hood. If you'd rather not hand-roll SQL against the app DB (and avoid exposing it), two lighter options:
-
Metabase MCP + Claude Code / Claude Desktop**.** Open-source MCP servers for Metabase let you ask an LLM things like "find any question whose SQL references
orders.refunded_at" in plain English. Good for occasional searches without touching the app DB. -
MetaLens (disclosure: I built it). Connects to Metabase via API key and runs semantic search over every saved question and dashboard, plus a chat agent that knows your schema. The search piece is on the free tier. https://metalens.it
Both keep you out of the app DB, which is the part @dwhitemv rightly flagged as risky.
Thank you both - I will explore both options.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.