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
* Refactor crud ops to use LogicalName as input
* self PR review
* PR comments
* merge with optionset change
* extra entity_set
---------
Co-authored-by: Tim Pellissier <tpellissier@microsoft.com>
- Bulk create — Pass a list of records to `create(...)` to invoke the bound `CreateMultiple` action; returns `list[str]` of GUIDs. If any payload omits `@odata.type` the SDK resolves and stamps it (cached).
8
8
- Bulk update — Provide a list of IDs with a single patch (broadcast) or a list of per‑record patches to `update(...)`; internally uses the bound `UpdateMultiple` action; returns nothing. Each record must include the primary key attribute when sent to UpdateMultiple.
9
9
- Retrieve multiple (paging) — Generator-based `get_multiple(...)` that yields pages, supports `$top` and Prefer: `odata.maxpagesize` (`page_size`).
10
-
- Upload files — Call `upload_file(entity_set, ...)` and a upload method will be auto picked (user can also overwrite the upload mode). See https://learn.microsoft.com/en-us/power-apps/developer/data-platform/file-column-data?tabs=sdk#upload-files
10
+
- Upload files — Call `upload_file(logical_name, ...)` and an upload method will be auto picked (you can override the mode). See https://learn.microsoft.com/en-us/power-apps/developer/data-platform/file-column-data?tabs=sdk#upload-files
- Bulk create via `CreateMultiple` (collection-bound) by passing `list[dict]` to `create(entity_set, payloads)`; returns list of created IDs.
21
-
- Bulk update via `UpdateMultiple` (invoked internally) by calling unified `update(entity_set, ids, patch|patches)`; returns nothing.
20
+
- Bulk create via `CreateMultiple` (collection-bound) by passing `list[dict]` to `create(logical_name, payloads)`; returns list of created IDs.
21
+
- Bulk update via `UpdateMultiple` (invoked internally) by calling unified `update(logical_name, ids, patch|patches)`; returns nothing.
22
22
- Retrieve multiple with server-driven paging: `get_multiple(...)` yields lists (pages) following `@odata.nextLink`. Control total via `$top` and per-page via `page_size` (Prefer: `odata.maxpagesize`).
23
23
- Upload files, using either a single request (supports file size up to 128 MB) or chunk upload under the hood
24
24
- Optional pandas integration (`PandasODataClient`) for DataFrame based create / get / query.
# Bulk update (1:1) – list of patches matches list of IDs
147
-
client.update("accounts", ids, [
147
+
client.update("account", ids, [
148
148
{"telephone1": "555-1200"},
149
149
{"telephone1": "555-1300"},
150
150
])
151
151
print({"multi_update": "ok"})
152
152
153
153
# Delete
154
-
client.delete("accounts", account_id)
154
+
client.delete("account", account_id)
155
155
156
156
# SQL (read-only) via Web API `?sql=`
157
157
rows = client.query_sql("SELECT TOP 3 accountid, name FROM account ORDER BY createdon DESC")
@@ -160,7 +160,7 @@ for r in rows:
160
160
161
161
## Bulk create (CreateMultiple)
162
162
163
-
Pass a list of payloads to `create(entity_set, payloads)` to invoke the collection-bound `Microsoft.Dynamics.CRM.CreateMultiple` action. The method returns `list[str]` of created record IDs.
163
+
Pass a list of payloads to `create(logical_name, payloads)` to invoke the collection-bound `Microsoft.Dynamics.CRM.CreateMultiple` action. The method returns `list[str]` of created record IDs.
164
164
165
165
```python
166
166
# Bulk create accounts (returns list of GUIDs)
@@ -169,7 +169,7 @@ payloads = [
169
169
{"name": "Fabrikam"},
170
170
{"name": "Northwind"},
171
171
]
172
-
ids = client.create("accounts", payloads)
172
+
ids = client.create("account", payloads)
173
173
assertisinstance(ids, list) andall(isinstance(x, str) for x in ids)
174
174
print({"created_ids": ids})
175
175
```
@@ -180,10 +180,10 @@ Use the unified `update` method for both single and bulk scenarios:
Use `get_multiple(entity_set, ...)` to stream results page-by-page. You can cap total results with `$top` and hint the per-page size with `page_size` (sets Prefer: `odata.maxpagesize`).
219
+
Use `get_multiple(logical_name, ...)` to stream results page-by-page. You can cap total results with `$top` and hint the per-page size with `page_size` (sets Prefer: `odata.maxpagesize`).
220
220
221
221
```python
222
-
# Iterate pages of accounts ordered by name, selecting a few columns
223
222
pages = client.get_multiple(
224
-
"accounts",
223
+
"account",
225
224
select=["accountid", "name", "createdon"],
226
225
orderby=["name asc"],
227
226
top=10, # stop after 10 total rows (optional)
@@ -235,8 +234,8 @@ for page in pages: # each page is a list[dict]
235
234
print({"total_rows": total})
236
235
```
237
236
238
-
Parameters (all optional except `entity_set`)
239
-
-`entity_set`: str — Entity set (plural logical name), e.g., `"accounts"`.
client.delete(entity_set, rec[id_attr])# delete record
336
-
client.delete_table("SampleItem") # delete the table
333
+
client.delete(logical, rec_id) # delete record
334
+
client.delete_table("SampleItem") # delete table (friendly name or explicit schema new_SampleItem)
337
335
```
338
336
339
337
Notes:
@@ -346,7 +344,7 @@ Notes:
346
344
347
345
### Pandas helpers
348
346
349
-
See `examples/quickstart_pandas.py` for a DataFrame workflow via `PandasODataClient`.
347
+
`PandasODataClient` is a thin wrapper around the low-level client. All methods accept logical (singular) names (e.g. `account`, `new_sampleitem`), not entity set (plural) names. See `examples/quickstart_pandas.py` for a DataFrame workflow.
350
348
351
349
VS Code Tasks
352
350
- Install deps: `Install deps (pip)`
@@ -356,7 +354,6 @@ VS Code Tasks
356
354
- No general-purpose OData batching, upsert, or association operations yet.
357
355
-`DeleteMultiple` not yet exposed.
358
356
- Minimal retry policy in library (network-error only); examples include additional backoff for transient Dataverse consistency.
359
-
- Entity naming conventions in Dataverse: for bulk create the SDK resolves logical names from entity set metadata.
0 commit comments