You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-15Lines changed: 24 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ A minimal Python SDK to use Microsoft Dataverse as a database for Azure AI Found
4
4
5
5
- Read (SQL) — Execute read-only T‑SQL via the McpExecuteSqlQuery Custom API. Returns `list[dict]`.
6
6
- OData CRUD — Thin wrappers over Dataverse Web API (create/get/update/delete).
7
-
- Bulk create — Pass a list of records to `create(...)` to invoke the bound `CreateMultiple` action; returns `list[str]` of GUIDs.
7
+
- Bulk create — Pass a list of records to `create(...)` to invoke the bound `CreateMultiple` action; returns `list[str]` of GUIDs. If `@odata.type` is absent the SDK resolves the logical name from metadata (cached).
8
8
- Retrieve multiple (paging) — Generator-based `get_multiple(...)` that yields pages, supports `$top` and Prefer: `odata.maxpagesize` (`page_size`).
- The bulk create response typically includes IDs only; the SDK returns the list of GUID strings.
129
129
- Single-record `create` still returns the full entity representation.
130
+
-`@odata.type` handling: If any payload in the list omits `@odata.type`, the SDK performs a one-time metadata query (`EntityDefinitions?$filter=EntitySetName eq '<entity_set>'`) to resolve the logical name, caches it, and stamps each missing item with `Microsoft.Dynamics.CRM.<logical>`. If **all** payloads already include `@odata.type`, no metadata call is made.
131
+
- The metadata lookup is per entity set and reused across subsequent multi-create calls in the same client instance (in-memory cache only).
132
+
- You can explicitly set `@odata.type` yourself (e.g., for polymorphic scenarios); the SDK will not override it.
130
133
131
134
## Retrieve multiple with paging
132
135
@@ -149,16 +152,20 @@ for page in pages: # each page is a list[dict]
149
152
print({"total_rows": total})
150
153
```
151
154
152
-
Parameters
153
-
-`entity`: str — Entity set name (plural logical name), e.g., `"accounts"`.
154
-
-`select`: list[str] | None — Columns to include; joined into `$select`.
-`page_size`: int | None — Per-page hint using Prefer: `odata.maxpagesize=<N>` (not guaranteed; last page may be smaller).
163
+
164
+
Return value & semantics
165
+
- Returns a generator yielding non-empty pages (`list[dict]`). Empty pages are skipped.
166
+
- Each yielded list corresponds to a `value` page from the Web API.
167
+
- Iteration stops when no `@odata.nextLink` remains (or when `$top` satisfied server-side).
168
+
- The generator does not materialize all results; pages are fetched lazily.
162
169
163
170
Example (all parameters + expected response)
164
171
@@ -193,9 +200,11 @@ for page in pages: # page is list[dict]
193
200
```
194
201
195
202
Semantics:
196
-
-`$top`: caps the total number of rows returned across all pages.
197
-
-`page_size`: per-page size hint via Prefer: `odata.maxpagesize`; the service may return fewer/more.
198
-
- The generator follows `@odata.nextLink` until exhausted or `$top` is satisfied.
203
+
-`$select`, `$filter`, `$orderby`, `$expand`, `$top` map directly to corresponding OData query options on the first request.
204
+
-`$top` caps total rows; the service may partition those rows across multiple pages.
205
+
-`page_size` (Prefer: `odata.maxpagesize`) is a hint; the server decides actual page boundaries.
206
+
- The generator follows `@odata.nextLink` until exhausted (service already accounts for `$top`).
207
+
- Only non-empty pages are yielded; if the first response has no `value`, iteration ends immediately.
199
208
```
200
209
201
210
### Custom table (metadata) example
@@ -248,7 +257,7 @@ VS Code Tasks
248
257
- No general-purpose OData batching, upsert, or association operations yet.
249
258
-`DeleteMultiple`/`UpdateMultiple` are not exposed; quickstart may demonstrate faster deletes using client-side concurrency only.
250
259
- Minimal retry policy in library (network-error only); examples include additional backoff for transient Dataverse consistency.
251
-
- Entity naming conventions in Dataverse (schema/logical/entity set plural & publisher prefix) using the SDK is currently not well-defined
260
+
- Entity naming conventions in Dataverse (schema/logical/entity set plural & publisher prefix) are only partially abstracted; for multi-create the SDK resolves logical names from entity set metadata.
0 commit comments