Skip to content

Commit 1404b92

Browse files
Abel Milashclaude
andcommitted
Revert example script import changes
User feedback: the import changes in README.md and SKILL.md are enough. Example scripts can stay with their original (main) import style. 8 files reverted to main's content: - examples/advanced/{alternate_keys_upsert,dataframe_operations,datascience_risk_assessment, prodev_quick_start,relationships,walkthrough}.py - examples/basic/{functional_testing,installation_example}.py Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2a377b3 commit 1404b92

20 files changed

Lines changed: 78 additions & 167 deletions

examples/advanced/alternate_keys_upsert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import time
2424

2525
from PowerPlatform.Dataverse.client import DataverseClient
26-
from PowerPlatform.Dataverse.models import UpsertItem
26+
from PowerPlatform.Dataverse.models.upsert import UpsertItem
2727
from azure.identity import InteractiveBrowserCredential # type: ignore
2828

2929
# --- Config ---

examples/advanced/dataframe_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from azure.identity import InteractiveBrowserCredential
2020

2121
from PowerPlatform.Dataverse.client import DataverseClient
22-
from PowerPlatform.Dataverse.models import col, raw
22+
from PowerPlatform.Dataverse.models.filters import col, raw
2323

2424

2525
def main():

examples/advanced/datascience_risk_assessment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from azure.identity import InteractiveBrowserCredential
5151

5252
from PowerPlatform.Dataverse.client import DataverseClient
53-
from PowerPlatform.Dataverse.models import col, raw
53+
from PowerPlatform.Dataverse.models.filters import col, raw
5454

5555
# -- Optional imports (graceful degradation if not installed) ------
5656

examples/advanced/prodev_quick_start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from azure.identity import InteractiveBrowserCredential
5757

5858
from PowerPlatform.Dataverse.client import DataverseClient
59-
from PowerPlatform.Dataverse.models import col
59+
from PowerPlatform.Dataverse.models.filters import col
6060

6161
# -- Table schema names --
6262
# Uses the standard 'new_' publisher prefix (default Dataverse publisher).

examples/advanced/relationships.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
import time
2121
from azure.identity import InteractiveBrowserCredential
2222
from PowerPlatform.Dataverse.client import DataverseClient
23-
from PowerPlatform.Dataverse.models import (
24-
CascadeConfiguration,
25-
Label,
26-
LocalizedLabel,
23+
from PowerPlatform.Dataverse.models.relationship import (
2724
LookupAttributeMetadata,
28-
ManyToManyRelationshipMetadata,
2925
OneToManyRelationshipMetadata,
26+
ManyToManyRelationshipMetadata,
27+
CascadeConfiguration,
3028
)
29+
from PowerPlatform.Dataverse.models.labels import Label, LocalizedLabel
3130
from PowerPlatform.Dataverse.common.constants import (
3231
CASCADE_BEHAVIOR_NO_CASCADE,
3332
CASCADE_BEHAVIOR_REMOVE_LINK,

examples/advanced/walkthrough.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from azure.identity import InteractiveBrowserCredential
2727
from PowerPlatform.Dataverse.client import DataverseClient
2828
from PowerPlatform.Dataverse.core.errors import MetadataError
29-
from PowerPlatform.Dataverse.models import ExpandOption, col
29+
from PowerPlatform.Dataverse.models.filters import col
30+
from PowerPlatform.Dataverse.models.query_builder import ExpandOption
3031
import requests
3132

3233

examples/basic/functional_testing.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,18 @@
3434
# Import SDK components (assumes installation is already validated)
3535
from PowerPlatform.Dataverse.client import DataverseClient
3636
from PowerPlatform.Dataverse.core.errors import HttpError, MetadataError
37-
from PowerPlatform.Dataverse.models import (
38-
CascadeConfiguration,
39-
Label,
40-
LocalizedLabel,
37+
from PowerPlatform.Dataverse.models.relationship import (
4138
LookupAttributeMetadata,
42-
ManyToManyRelationshipMetadata,
4339
OneToManyRelationshipMetadata,
44-
UpsertItem,
40+
ManyToManyRelationshipMetadata,
41+
CascadeConfiguration,
4542
)
43+
from PowerPlatform.Dataverse.models.labels import Label, LocalizedLabel
4644
from PowerPlatform.Dataverse.common.constants import (
4745
CASCADE_BEHAVIOR_NO_CASCADE,
4846
CASCADE_BEHAVIOR_REMOVE_LINK,
4947
)
48+
from PowerPlatform.Dataverse.models.upsert import UpsertItem
5049
from azure.identity import InteractiveBrowserCredential
5150

5251

examples/basic/installation_example.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060
from typing import Optional
6161
from datetime import datetime
6262

63-
from PowerPlatform.Dataverse.operations import FileOperations, QueryOperations, RecordOperations, TableOperations
63+
from PowerPlatform.Dataverse.operations.records import RecordOperations
64+
from PowerPlatform.Dataverse.operations.query import QueryOperations
65+
from PowerPlatform.Dataverse.operations.tables import TableOperations
66+
from PowerPlatform.Dataverse.operations.files import FileOperations
6467

6568

6669
def validate_imports():
@@ -82,7 +85,7 @@ def validate_imports():
8285

8386
print(f" [OK] Core errors: HttpError, MetadataError")
8487

85-
from PowerPlatform.Dataverse.core import DataverseConfig
88+
from PowerPlatform.Dataverse.core.config import DataverseConfig
8689

8790
print(f" [OK] Core config: DataverseConfig")
8891

src/PowerPlatform/Dataverse/__init__.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,10 @@
33

44
from importlib.metadata import version
55

6-
# Set __version__ FIRST. Downstream modules (e.g. data/_odata_base.py) import
7-
# this back from the top-level package, so it must be bound before any
8-
# transitive import of those modules runs.
9-
__version__ = version("PowerPlatform-Dataverse-Client")
10-
11-
from .client import DataverseClient
126
from .models.filters import col, raw
137
from .models.protocol import DataverseModel
148
from .models.record import QueryResult
159

16-
__all__ = [
17-
"DataverseClient",
18-
"DataverseModel",
19-
"QueryResult",
20-
"__version__",
21-
"col",
22-
"raw",
23-
]
10+
__version__ = version("PowerPlatform-Dataverse-Client")
11+
12+
__all__ = ["__version__", "col", "raw", "DataverseModel", "QueryResult"]

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ client.records.update("account", [id1, id2, id3], {"industry": "Technology"})
212212
Creates or updates records identified by alternate keys. Single item -> PATCH; multiple items -> `UpsertMultiple` bulk action.
213213
> **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.
214214
```python
215-
from PowerPlatform.Dataverse.models import UpsertItem
215+
from PowerPlatform.Dataverse.models.upsert import UpsertItem
216216

217217
# Single upsert
218218
client.records.upsert("account", [
@@ -403,12 +403,12 @@ client.tables.delete("new_Product")
403403

404404
#### Create One-to-Many Relationship
405405
```python
406-
from PowerPlatform.Dataverse.models import (
407-
CascadeConfiguration,
408-
Label,
409-
LocalizedLabel,
406+
from PowerPlatform.Dataverse.models.relationship import (
410407
LookupAttributeMetadata,
411408
OneToManyRelationshipMetadata,
409+
Label,
410+
LocalizedLabel,
411+
CascadeConfiguration,
412412
)
413413
from PowerPlatform.Dataverse.common.constants import CASCADE_BEHAVIOR_REMOVE_LINK
414414

@@ -435,7 +435,7 @@ print(f"Created lookup field: {result['lookup_schema_name']}")
435435

436436
#### Create Many-to-Many Relationship
437437
```python
438-
from PowerPlatform.Dataverse.models import ManyToManyRelationshipMetadata
438+
from PowerPlatform.Dataverse.models.relationship import ManyToManyRelationshipMetadata
439439

440440
relationship = ManyToManyRelationshipMetadata(
441441
schema_name="new_employee_project",
@@ -535,9 +535,9 @@ The SDK provides structured exceptions with detailed error information:
535535
from PowerPlatform.Dataverse.core.errors import (
536536
DataverseError,
537537
HttpError,
538-
MetadataError,
539-
SQLParseError,
540538
ValidationError,
539+
MetadataError,
540+
SQLParseError
541541
)
542542
from PowerPlatform.Dataverse.client import DataverseClient
543543

0 commit comments

Comments
 (0)