Skip to content

Commit 1888824

Browse files
author
Saurabh Badenkal
committed
Add get() raises docs, fix isort, replace non-ASCII chars in SKILL.md and example
1 parent 3a5dfc3 commit 1888824

4 files changed

Lines changed: 20 additions & 14 deletions

File tree

.claude/skills/dataverse-sdk-use/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ client.records.update("account", [id1, id2, id3], {"industry": "Technology"})
132132
```
133133

134134
#### Upsert Records
135-
Creates or updates records identified by alternate keys. Single item PATCH; multiple items `UpsertMultiple` bulk action.
135+
Creates or updates records identified by alternate keys. Single item -> PATCH; multiple items -> `UpsertMultiple` bulk action.
136136
> **Prerequisite**: The table must have an alternate key configured in Dataverse for the columns used in `alternate_key`. Without it, Dataverse will reject the request with a 400 error.
137137
```python
138138
from PowerPlatform.Dataverse.models.upsert import UpsertItem
@@ -181,7 +181,7 @@ The SDK provides DataFrame wrappers for all CRUD operations via the `client.data
181181
```python
182182
import pandas as pd
183183

184-
# Query records returns a single DataFrame
184+
# Query records -- returns a single DataFrame
185185
df = client.dataframe.get("account", filter="statecode eq 0", select=["name"])
186186
print(f"Got {len(df)} rows")
187187

examples/advanced/dataframe_operations.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
def main():
24-
# ── Setup & Authentication ────────────────────────────────────
24+
# -- Setup & Authentication ------------------------------------
2525
base_url = input("Enter Dataverse org URL (e.g. https://yourorg.crm.dynamics.com): ").strip()
2626
if not base_url:
2727
print("[ERR] No URL entered; exiting.")
@@ -46,7 +46,7 @@ def _run_walkthrough(client):
4646

4747
select_cols = ["name", "telephone1", "websiteurl", "lastonholdtime"]
4848

49-
# ── 1. Create records from a DataFrame ────────────────────────
49+
# -- 1. Create records from a DataFrame ------------------------
5050
print("\n" + "-" * 60)
5151
print("1. Create records from a DataFrame")
5252
print("-" * 60)
@@ -75,7 +75,7 @@ def _run_walkthrough(client):
7575
print(f"[OK] Created {len(new_accounts)} records")
7676
print(f" IDs: {new_accounts['accountid'].tolist()}")
7777

78-
# ── 2. Query records as a DataFrame ─────────────────────────
78+
# -- 2. Query records as a DataFrame -------------------------
7979
print("\n" + "-" * 60)
8080
print("2. Query records as a DataFrame")
8181
print("-" * 60)
@@ -85,7 +85,7 @@ def _run_walkthrough(client):
8585
print(f" Columns: {list(df_all.columns)}")
8686
print(f"{df_all.to_string(index=False)}")
8787

88-
# ── 3. Limit results with top ──────────────────────────────
88+
# -- 3. Limit results with top ------------------------------
8989
print("\n" + "-" * 60)
9090
print("3. Limit results with top")
9191
print("-" * 60)
@@ -94,7 +94,7 @@ def _run_walkthrough(client):
9494
print(f"[OK] Got {len(df_top2)} records with top=2")
9595
print(f"{df_top2.to_string(index=False)}")
9696

97-
# ── 4. Fetch a single record by ID ────────────────────────────
97+
# -- 4. Fetch a single record by ID ----------------------------
9898
print("\n" + "-" * 60)
9999
print("4. Fetch a single record by ID")
100100
print("-" * 60)
@@ -104,7 +104,7 @@ def _run_walkthrough(client):
104104
single = client.dataframe.get(table, record_id=first_id, select=select_cols)
105105
print(f"[OK] Single record DataFrame:\n{single.to_string(index=False)}")
106106

107-
# ── 5. Update records from a DataFrame ────────────────────────
107+
# -- 5. Update records from a DataFrame ------------------------
108108
print("\n" + "-" * 60)
109109
print("5. Update records with different values per row")
110110
print("-" * 60)
@@ -118,7 +118,7 @@ def _run_walkthrough(client):
118118
verified = client.dataframe.get(table, select=select_cols, filter=test_filter)
119119
print(f" Verified:\n{verified.to_string(index=False)}")
120120

121-
# ── 6. Broadcast update (same value to all records) ───────────
121+
# -- 6. Broadcast update (same value to all records) -----------
122122
print("\n" + "-" * 60)
123123
print("6. Broadcast update (same value to all records)")
124124
print("-" * 60)
@@ -151,7 +151,7 @@ def _run_walkthrough(client):
151151
verified = client.dataframe.get(table, select=select_cols, filter=test_filter)
152152
print(f" Verified (Contoso websiteurl should be empty):\n{verified.to_string(index=False)}")
153153

154-
# ── 7. Delete records by passing a Series of GUIDs ────────────
154+
# -- 7. Delete records by passing a Series of GUIDs ------------
155155
print("\n" + "-" * 60)
156156
print("7. Delete records by passing a Series of GUIDs")
157157
print("-" * 60)

src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-use/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ client.records.update("account", [id1, id2, id3], {"industry": "Technology"})
132132
```
133133

134134
#### Upsert Records
135-
Creates or updates records identified by alternate keys. Single item PATCH; multiple items `UpsertMultiple` bulk action.
135+
Creates or updates records identified by alternate keys. Single item -> PATCH; multiple items -> `UpsertMultiple` bulk action.
136136
> **Prerequisite**: The table must have an alternate key configured in Dataverse for the columns used in `alternate_key`. Without it, Dataverse will reject the request with a 400 error.
137137
```python
138138
from PowerPlatform.Dataverse.models.upsert import UpsertItem
@@ -181,7 +181,7 @@ The SDK provides DataFrame wrappers for all CRUD operations via the `client.data
181181
```python
182182
import pandas as pd
183183

184-
# Query records returns a single DataFrame
184+
# Query records -- returns a single DataFrame
185185
df = client.dataframe.get("account", filter="statecode eq 0", select=["name"])
186186
print(f"Got {len(df)} rows")
187187

src/PowerPlatform/Dataverse/operations/dataframe.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
from typing import Any, Dict, List, Optional, TYPE_CHECKING
8+
from typing import TYPE_CHECKING, Any, Dict, List, Optional
99

1010
import pandas as pd
1111

@@ -91,6 +91,10 @@ def get(
9191
when no records match.
9292
:rtype: ~pandas.DataFrame
9393
94+
:raises ValueError: If ``record_id`` is not a non-empty string, or if
95+
query parameters (``filter``, ``orderby``, ``top``, ``expand``,
96+
``page_size``) are provided alongside ``record_id``.
97+
9498
.. tip::
9599
For large tables, use ``top`` or ``filter`` to limit the result set.
96100
@@ -312,7 +316,9 @@ def delete(
312316
:raises ValueError: If ``ids`` contains invalid (non-string, empty, or
313317
whitespace-only) values.
314318
315-
:return: BulkDelete job ID when deleting multiple records via BulkDelete; otherwise ``None``.
319+
:return: BulkDelete job ID when deleting multiple records via BulkDelete;
320+
``None`` when deleting a single record, using sequential deletion, or
321+
when ``ids`` is empty.
316322
:rtype: :class:`str` or None
317323
318324
Example:

0 commit comments

Comments
 (0)