dv-query
Skill: Query — Read and Analyze Dataverse Records
This skill uses Python exclusively. Do not use Node.js, JavaScript, or any other language for Dataverse scripting. See the overview skill's Hard Rules.
Reads: prefer a managed surface, choose by shape
Pick MCP or the SDK by the shape of the read — both handle auth, paging, and retry (see the routing table below and the overview's Tool Capabilities / Hard Rule 2). MCP fits small, interactive reads; the SDK fits bulk iteration and analytics. For $apply aggregation and N:N $expand, prefer client.query.fetchxml() (aggregates + link-entity) or the managed dataverse api escape hatch; reach for hand-rolled urllib/get_token() only to stay in-process inside a tight Python loop (e.g. paging thousands of rows with client-side processing — see web-api-advanced.md).
Dataverse CLI gotchas (custom tables + Windows)
When you drive the dataverse CLI directly (headless reads/CRUD; note the CLI needs .NET + a keyring, so it is blocked on ChatGPT web / Codex cloud — use the SDK there), two empirical traps:
- Custom-table SQL pluralization.
dataverse data queryin SQL mode auto-pluralizes the table name, and irregular plurals resolve wrong:FROM im_categorylooks up entity setim_categorysand returns a 404 that reads like "table missing." It is not — switch to OData mode with the explicit entity set:dataverse data query --table im_categories --select im_name. Discover the realEntitySetNamefromEntityDefinitionswhen unsure; never conclude the table doesn't exist from this 404. - Windows shell quoting. Wrap the whole
--pathvalue in double quotes socmd.exe/PowerShell don't treat&as a command separator. Keep&literal — it separates OData query options; encoding it to%26merges them and breaks the query. Encode only$->%24(in PowerShell a bare$selectis read as a variable). If an unquoted&splits the command, the wrapper can exit nonzero even when the API returned valid JSON — quoting prevents it. (This is why thedataverse api requestexamples in other skills quote the path, use%24, and leave&literal.)
ERP target is a separate path. ERP (Finance and Operations), when linked to a Dataverse env, does not go through the Python SDK. See references/erp-reads.md.