Skip to content
Skills Library
Data & analytics · Building & coding

kx-query

/kx-query

Use this when creating or changing a KX Dashboards data source: choose the data type, write or validate a kdb+/SQL query, wire ViewState parameters, set polling or streaming, or bind query results to widgets. Read it before generating queries for charts, grids, forms, maps, or actions in a dashboard.

Repository
kx-skills ↗
Licence
Apache-2.0
Last repository change
15.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
6
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 15.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use this when creating or changing a KX Dashboards data source: choose the data type, write or validate a kdb+/SQL query, wire ViewState parameters, set polling or streaming, or bind query results to widgets. Read it before generating queries for charts, grids, forms, maps, or actions in a dashboard.

Original author description

Use this when creating or changing a KX Dashboards data source: choose the data type, write or validate a kdb+/SQL query, wire ViewState parameters, set polling or streaming, or bind query results to widgets. Read it before generating queries for charts, grids, forms, maps, or actions in a dashboard.

How it works

  1. Reference Files
  2. ⚠️ Hazards
  3. Workflow
Original SKILL.md headings · 43 lines, 549 words
SKILL.md preview
---
name: kx-query
description: "Use this when creating or changing a KX Dashboards data source: choose the data type, write or validate a kdb+/SQL query, wire ViewState parameters, set polling or streaming, or bind query results to widgets. Read it before generating queries for charts, grids, forms, maps, or actions in a dashboard."
requires:
  - kx-dashboard-core
---

# KX Query & Data Sources

> Depends on **kx-dashboard-core** for the dashboard envelope, ViewState schema, and binding patterns.

This skill uses **progressive disclosure**: the hazards, workflow, and validation rules are here; the connection/data-source JSON schemas, query patterns, pivot config, reserved-word list, and dashboard-oriented q snippets live in `reference/`. Read only the reference file relevant to your current step.

## Reference Files

| File | Read it when you need… |
|---|---|
| [reference/schema.md](reference/schema.md) | The connection file format, `_dataType`/`_subscriptionType` values, and the full JSON template for every data source kind (query, analytic, virtual, pykx, polling, streaming, update query, ViewState params). |
| [reference/query-patterns.md](reference/query-patterns.md) | kdb+ query idioms, filtering by ViewState type (symbol / string `like` / list), component-side binding, and symbol-vs-string handling. |
| [reference/pivot-grid.md](reference/pivot-grid.md) | The Pivot Grid data source (`key: "Datatable"`) — pivot attributes, `_layout`, `_mappings`, and the full template. |
| [reference/reserved-words.md](reference/reserved-words.md) | The reserved-word list and the validation algorithm to run before accepting any kdb+ query string. |
| [reference/q-language.md](reference/q-language.md) | Dashboard-oriented q snippets only — the few q patterns that matter specifically when writing KX Dashboards data sources (not general q fundamentals like operators, iterators, system commands, or data types). |

---

## ⚠️ Hazards

1. **Always write both `_autoExecute` and `_autoExec`** — some versions only honour one.
2. **`_connection` must match the connection file `name` field exactly** (case-sensitive).
3. **`_subscriptionType: "streaming"` requires a streaming-capable connection** — don't use it with static kdb+ processes.
4. **ViewState param `value` must use the template syntax** (`<%group/name%>` or `<%name%>`), not a raw value.
5. **`_dataType: "pykx"` requires PyKX to be installed** on the kdb+ process.
6. **Polling interval is in seconds** (`_subscriptionInterval`). Minimum meaningful value is `1`.
7. **Reserved words must never appear as assignment targets** — assigning to a reserved word (e.g. `sum: 5`) raises `'assign` at runtime. **Run reserved-word validation before accepting any query.** See the Reserved Word Validation section below.
8. **Analytics run a named function, not a query.** `_selectedAnalytic` is a dotted kdb+ function name (e.g. `.fx.sub`), not a table. A **streaming** analytic must copy its `_analyticParams` into `_streamingParameters` (identical) — the subscription reads its arguments from `_streamingParameters`. See the Analytic Data Source section in `reference/schema.md`.


---

## Workflow

1. **Confirm the connection.** You need a connection name that matches the connection file `name` field exactly (case-sensitive). Connection file format is in `reference/schema.md`.
2. **Choose the data source type.** Pick `_dataType` (query / analytic / virtual / pykx / builder) and `_subscriptionType` (static / polling / streaming / subscription). See the tables and per-type JSON templates in `reference/schema.md`.
3. **Write the query string.** Use the kdb+/SQL idioms in `reference/query-patterns.md`. For a Pivot Grid, do NOT aggregate in the query — use the pivot attributes in `reference/pivot-grid.md`.
4. **Wire ViewState parameters.** Add `_queryParams` entries with `<%group/name%>` template syntax and the correct kdb+ `type`; match each to a ViewState. Symbol / string / list filter patterns are in `reference/query-patterns.md`.
5. **Validate reserved words.** Run the reserved-word check in `reference/reserved-words.md` against the query string and reject on any match. This is mandatory (Hazard 7).
6. **Bind the source to components.** Reference it via `{ "_dashboardsType": "data", "value": "<name>" }` and/or a `query` action (see `reference/query-patterns.md`).
7. **Check against the Hazards above** — set both `_autoExecute` and `_autoExec`, confirm streaming needs, and use per-second polling intervals.
Files in this package (6)
  • SKILL.md 4 KB
  • reference/pivot-grid.md 3 KB
  • reference/q-language.md 1 KB
  • reference/query-patterns.md 4 KB
  • reference/reserved-words.md 2 KB
  • reference/schema.md 8 KB

Versions

The database has no other skills named kx-query.

Database snapshot: 13.11.2026 · package version 9ca78928add1 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100kx-datafilter
    Generate KX Dashboards input and filter components: DataFilter (visual filter builder, definitionId=48) and QueryBuilder (visual kdb+ query constructor, definitionId=10254). Use when the user asks for a filter panel, filter builder, AND/OR filter, or query builder for a grid or…
  • 100sql-query-optimizer
    Optimize sql query optimizer operations. Auto-activating skill for Data Analytics. Triggers on: sql query optimizer, sql query optimizer Part of the Data Analytics skill category. Use when working with sql query optimizer functionality. Trigger with phrases like "sql query…
  • 100kx-dashboard-core
    Use this when building or editing any KX Dashboards JSON dashboard: start here for the dashboard envelope, screens, widget wrapper, ViewState, data sources, actions, notifications, deployment, and the pre-flight checklist. Load it before component skills such as kx-chartgl,…
  • 100ggsql
    Write ggsql queries — a grammar of graphics for SQL. Use when the user wants to create, modify, or understand a ggsql visualization query.
  • 100flux-query
    Optimize slow database queries — analyze execution plans, add indexes, rewrite queries. Use when asked about "slow query", "optimize SQL", "query performance", or "explain this query".
  • 100query-optimizer
    Optimize SQL queries for performance with indexing strategies, query rewriting, and execution plan analysis. Use when queries are slow, optimizing database performance, or analyzing query execution.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.