Rule: Domo App Platform Data Access (Toolkit-First)
This rule is toolkit/query-first. Use @domoinc/query for dataset reads in apps.
Canonical Query Approach
1) Use @domoinc/query for dataset queries
yarn add @domoinc/queryimport Query from '@domoinc/query';
const salesByRegion = await new Query()
.select(['region', 'Sales_Amount'])
.groupBy('region', { Sales_Amount: 'sum' })
.orderBy('Sales_Amount', 'descending')
.fetch('sales');2) Keep SQL as exception-only
If you use SQL (SqlClient), remember it does not automatically respect page filters in dashboards.
import { SqlClient } from '@domoinc/toolkit';
const sqlClient = new SqlClient();
const result = await sqlClient.get(
'sales',
'SELECT region, SUM(Sales_Amount) AS total FROM sales GROUP BY region'
);
const rows = result.body.rows;Required Manifest Wiring
Every dataset still must be declared in manifest.json under datasetsMapping.
{
"datasetsMapping": [
{ "alias": "sales", "dataSetId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "fields": [] }
]
}Critical gotcha:
fieldsmust exist (can be[]) to avoid manifest parsing errors.
Local Development
- Use
@domoinc/ryuu-proxyfor local API routing. - Authenticate with
domo login.
Checklist
datasetsMappingaliases configured and valid- Queries implemented with
Query(not raw/data/v1by default) - Aggregations use actual dataset field names
.aggregate()not used