一键导入
sql-query
Use SqlClient for raw SQL against mapped dataset aliases and parse columnar SQL responses safely.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use SqlClient for raw SQL against mapped dataset aliases and parse columnar SQL responses safely.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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.
Domo KPI card CRUD via community-domo-cli — body schema, column mapping, beast modes, chart type index with on-demand reference files, and gotchas.
**Generating sample data for Domo** -- invoke when a user needs to create realistic sample datasets and upload them to a Domo instance. Primary signals: requests for sample data, demo data, test data, fake data for Domo; mentions of Salesforce, Google Analytics, QuickBooks, NetSuite, Google Ads, Facebook Ads, HubSpot, Marketo, or Health Portal sample data; questions about the datagen CLI or domo_data_generator. Covers: generating datasets, uploading to Domo, creating datasets in Domo, rolling dates, entity pools, connector icons, catalog management, and adding new dataset definitions. Skip for: real connector setup, production data pipelines, data transformations (Magic ETL), or Domo App Platform.
Create AppDB collections via CLI-first workflows where collection creation also provisions the required datastore, then returns collection identifiers for manifest wiring and document-write follow-up. Use when an agent must initialize new AppDB storage for a Domo app, not just list/get collections or create documents.
Create Domo Code Engine packages from CLI workflows with deterministic payload contracts, automatic function parameter datatype mapping, and manifest packagesMapping follow-up guidance. Use when an agent must create a new package/versioned package container rather than only invoke an existing function from app runtime code.
Update Domo Code Engine packages through CLI-driven versioned lifecycle workflows with compatibility checks, datatype contract safeguards, and manifest mapping drift synchronization. Use when an agent must update package code or create a new package version and keep app mappings aligned.
| name | sql-query |
| description | Use SqlClient for raw SQL against mapped dataset aliases and parse columnar SQL responses safely. |
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.