skills/custom-apps/sql-query/SKILL.md
Use SqlClient for raw SQL against mapped dataset aliases and parse columnar SQL responses safely.
npx skillsauth add stahura/domo-ai-vibe-rules sql-queryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply when executing SQL queries against Domo datasets, using AI-generated SQL from AIClient.text_to_sql, or any time you need to run raw SQL against a dataset alias. Use SqlClient from @domoinc/toolkit instead of domo.post('/sql/v1/').
SqlClient is the toolkit wrapper for Domo's SQL API. Use it to execute SQL queries against datasets mapped in manifest.json.
import { SqlClient } from '@domoinc/toolkit';
const sqlClient = new SqlClient();
get(alias, query)Executes a SQL query against a dataset.
const result = await sqlClient.get('datasetAlias', 'SELECT * FROM datasetAlias');
Parameters:
alias (string): dataset alias from manifest.json mappingsquery (string): SQL query stringReturns: Promise<Response<SqlResponse>>
parsePageFilters(datasets, produceClauses?)Transforms Domo page filters into SQL predicates.
// Get predicates as objects
const predicates = sqlClient.parsePageFilters(['datasetAlias']);
// Get predicates as WHERE/HAVING clause strings
const clauses = sqlClient.parsePageFilters(['datasetAlias'], true);
CRITICAL: SQL API returns a columnar format, not an array of row objects.
// Response shape:
{
columns: ['vendor', 'Total Spend'],
rows: [
['Sysco Utah', 1880794.74],
['Intermountain Meats', 809389.15]
],
metadata: [...],
numRows: 8,
numColumns: 2,
datasource: 'dataset-uuid',
fromcache: true
}
You must zip columns + rows into objects for UI rendering:
const result = await sqlClient.get('myAlias', sql);
const res = result?.body || result?.data || result;
const colNames: string[] = res?.columns || [];
const rawRows: unknown[][] = res?.rows || [];
const rows = rawRows.map((row) => {
const obj: Record<string, unknown> = {};
colNames.forEach((col, i) => {
obj[col] = row[i];
});
return obj;
});
// rows => [{ vendor: 'Sysco Utah', 'Total Spend': 1880794.74 }, ...]
Use AIClient to generate SQL, then SqlClient to execute it:
import { AIClient, SqlClient } from '@domoinc/toolkit';
// 1) Generate SQL from natural language
const aiResponse = await AIClient.text_to_sql(question, [
{
dataSourceName: 'myAlias',
description: 'Description of the dataset',
columns: [
{ name: 'vendor', type: 'string' },
{ name: 'amount', type: 'number' }
]
}
]);
const responseBody = aiResponse.data || aiResponse.body || aiResponse;
const sql = responseBody.output || responseBody.choices?.[0]?.output;
// 2) Execute SQL
const sqlClient = new SqlClient();
const result = await sqlClient.get('myAlias', sql);
// 3) Parse columnar response into row objects
const res = result?.body || result?.data || result;
const colNames: string[] = res?.columns || [];
const rawRows: unknown[][] = res?.rows || [];
const rows = rawRows.map((row) => {
const obj: Record<string, unknown> = {};
colNames.forEach((col, i) => {
obj[col] = row[i];
});
return obj;
});
SqlClient instead of domo.post('/sql/v1/').parsePageFilters() to inject filters manually when needed.FROM must match manifest alias (example: SELECT * FROM vendorPayments).columns + rows), never a flat array of objects..body, .data, or directly on result; parse defensively.tools
Step-by-step orchestrator for building Domo App Studio apps with native KPI cards via community-domo-cli. Sequences app creation, pages, theme, hero metrics, native charts, filter cards, layout assembly, and navigation. CLI-first — no raw API calls.
tools
Create, update, and execute Magic ETL dataflows programmatically via API and CLI. Covers DAG-based JSON dataflow definitions, input/transform/output node wiring, join operations, and execution lifecycle.
tools
Magic ETL dataflows via community-domo-cli — list, get-definition, create, update, run, execution status; JSON DAG actions, transforms, joins. Use when automating dataflows with the community Domo CLI end-to-end. For REST/Java-CLI–first flows or mixed API patterns, use magic-etl instead.
development
Clean, professional dashboard theme for Domo custom apps. CSS custom properties, layout patterns, typography, and design polish that feel native to the Domo platform. Includes OKLCH color palette, layered shadows, concentric border radius, tabular numbers, and micro-interaction patterns.