Meta Query¶
Write and run SQL against the MetaMiner Database (MMDB) from inside the MetaMiner Client (MMC), including the pbi schema that holds your collected Power BI, Fabric and Entra metadata.
License and permission
The Meta Query tab appears when your license edition includes Meta Query and your MetaMiner role grants Tab: Meta Query on every environment you load; one environment without it hides the tab. Deleting scripts from the shared catalog needs Delete Meta Query scripts from catalog. See Permissions Reference and Editions and Licensing.
Tab layout¶
Image of the Meta Query tab: schema tree with the Power BI group expanded on the left, two SQL editor tabs, a result grid and the toolbar
../../images/client/meta-query-tab.png
| Area | What it shows |
|---|---|
| Schema tree (left) | MetaMiner Database Schema with a Power BI group (the tables of the pbi schema) and a Metrics group. Expand a table to see its columns. |
| SQL editor tabs | One or more SQL sheets. Table and column names auto-complete with Ctrl+Space. |
| Result grid | Rows returned by the last run, with row count and total execution time. |
Right-click a table or column in the tree for Show Table Values or Show Column Values. Right-click a result cell for View XML (XML values) and Insert Env ID.
Run a query¶
- Open the Meta Query tab.
- Type the SQL in the editor, or open a saved script.
- Click Run or press F9. MetaMiner runs the first statement, or only the selected text if you selected part of the script.
- Read the results in the grid. Use F3 to move to the next row in the same column.
SELECT r.env_id, r.pbi_id AS report_pbi_id, r.name, r.modified_by, r.modified_date_time
FROM pbi.reports r
ORDER BY r.modified_date_time
LIMIT 100;
Editor toolbar:
| Button | What it does |
|---|---|
| Run | Runs the first query or the selected part of the script (F9). |
| Format | Reformats the SQL. |
| Clear | Clears the SQL script. |
| Save to File | Saves the script to a local .sql file. |
| Open from Disk | Loads a script from a local file. |
| Show History | Opens SQL History (Ctrl+Alt+H). |
| Export selector | Exports the result grid to CSV, Excel or a Fabric lakehouse. See Toolbar and Export. |
Where to start in the pbi schema
Useful tables include pbi.workspaces, pbi.reports, pbi.datasets (semantic models), pbi.dataflows, pbi.dashboards, pbi.apps, pbi.capacities, the *_users tables (access per item), pbi.activity_events, and the graph_* tables (Entra users, groups and licenses). Most tables have an env_id column that identifies the environment.
TODO: link the pbi schema reference page once it exists
Source to check: Help > Reference section; no MMDB schema page for Power BI is in the navigation yet.
Script Catalog¶
The Script Catalog stores SQL scripts on the MetaMiner Server (MMS) so other users can reuse them.
| Action | What it does |
|---|---|
| Open Catalog | Lists scripts with Script Name, Created By, Modified On, DB Connection, DB Type and Public. Search in SQL also searches script text. Open loads a script; Run loads and runs it. |
| Save to Catalog | Saves the current script with a name, optional comma-separated Tags, the DB Type and Public access (visible to all users) or private. |
| Import to Catalog | Imports exported Meta Query script files into the catalog. |
| Set Visibility to Public / Private | Changes who sees a catalog script. |
| Delete from Server | Removes the selected script from the catalog. Needs Delete Meta Query scripts from catalog. |
SQL History¶
Show History (Ctrl+Alt+H) lists the queries you ran from this client. Each entry keeps the SQL, the database, when it ran, the duration and a status: Succeeded, Cancelled, Timed out, Result limit, Results unavailable or Interrupted.
Type in Search to filter by SQL text; press Enter to open the entry in a new tab. History is kept per MetaMiner Server and per MetaMiner user on this computer, up to 500 recent queries; identical SQL is stored once. History needs a MetaMiner sign-in.
Show results as a tree¶
Show as Tree turns query results into a Power BI Explorer-style tree, so you can right-click the items and use the normal Object Actions. The client asks whether to include the children of the matched items.
The result must contain:
- a column named
ENV_ID(the environment), and - at least one column whose name ends with
PBI_ID, holding Power BI item IDs.
Column names are matched without regard to case. The example query above qualifies.
Large results¶
Before loading a result, the client checks its size:
| Result size | Behaviour | Client variable |
|---|---|---|
| Larger than 128 MB | The client warns "Result set is expected to be too large" and asks whether to continue. | -Dmq.large.resultset (MB) |
| Larger than 576 MB, or larger than the client's maximum memory | The client refuses to load it: "Result set of this query is too large! Please adjust your SQL query." | -Dmq.huge.resultset (MB) |
Add a LIMIT or a narrower WHERE clause, or ask your administrator to raise the client limits or memory.
Troubleshooting¶
The Meta Query tab is missing
Your role lacks Tab: Meta Query on at least one loaded environment, or your edition does not include it. Ask your MetaMiner administrator, or skip the environment without the permission in the Connection Manager.
Show as Tree reports missing columns
Add an env_id column and a column whose name ends with pbi_id to the SELECT list, and make sure the environments in the result are loaded.