Data console
The Data console lets the portal’s administrators ask questions of the data models in SQL: how many requests came in each month, which records have no owner, what a link table holds. It only ever reads. Open it from Data, with Query.
Turn it on
Section titled “Turn it on”The console is off until the portal’s files hold data-console.yaml:
enabled: truerows: 1000 # the most rows a query shows, 1 to 10000seconds: 5 # the most time a query may take, 1 to 30rows and seconds may be left out; these are their values then. If the page says the console cannot run here, the install’s operators have to allow the portal to set it up.
What a query may read
Section titled “What a query may read”A query is one SELECT. It reads:
- each model’s table, by the model’s id, with its fields as columns and
id,owner_id,created_at,created_by,updated_atandupdated_by; - each many-links field’s table,
<model>__<field>, withfrom_idandto_id.
The page lists these tables and their columns beside the query. Joins, subqueries, WITH (not recursive), GROUP BY, window functions, CASE and casts to the usual types work. So do the common functions for counting, adding up, text, numbers and dates. A query that asks for anything else, or names a table by another prefix, is refused before it runs, and the page says why.
select date_trunc('month', created_at) as month, count(*)from requestsgroup by 1order by 1A query shows at most rows rows and says when there were more. One that takes longer than seconds stops. One query of the portal runs at a time.
Download and keep
Section titled “Download and keep”Download CSV, Download XLSX and Download JSON run the query again and save its answer as a file. In the CSV, a text cell that a spreadsheet would read as a formula starts with '.
Give a query a Name and Save it to find it again in Saved queries. A query is yours unless you share it with the other administrators. Only you may change or delete yours.
Who may use it
Section titled “Who may use it”Only the portal’s administrators, never while seeing the portal as someone else. An app’s token needs the tenant:read and data access. Every query run is in the audit log, with the tables it read and how many rows it showed, never the query itself.