Skip to content

Commit d07e52d

Browse files
authored
Merge pull request #38 from microsoft/feature/sdk-restructure
feat: Complete SDK restructuring
2 parents 847d122 + c645173 commit d07e52d

33 files changed

+330
-18
lines changed

examples/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Dataverse SDK Examples
2+
3+
This directory contains comprehensive examples demonstrating how to use the Microsoft Dataverse SDK for Python.
4+
5+
## 📁 Directory Structure
6+
7+
### 🌱 Basic Examples (`basic/`)
8+
Get started quickly with fundamental Dataverse operations:
9+
- **`quickstart.py`** - Basic client setup, authentication, and simple CRUD operations
10+
- Authentication setup with Azure Identity
11+
- Creating, reading, updating, and deleting records
12+
- Basic error handling
13+
14+
### 🚀 Advanced Examples (`advanced/`)
15+
Explore powerful features for complex scenarios:
16+
- **`file_upload.py`** - File upload to Dataverse file columns with chunking
17+
- **`pandas_integration.py`** - DataFrame-based operations for data analysis
18+
19+
## 🚀 Getting Started
20+
21+
1. **Install Dependencies**:
22+
```bash
23+
pip install -r requirements.txt
24+
```
25+
26+
2. **Set Up Authentication**:
27+
Configure Azure Identity credentials (see individual examples for details)
28+
29+
3. **Run Basic Example**:
30+
```bash
31+
python examples/basic/quickstart.py
32+
```
33+
34+
## 📋 Prerequisites
35+
36+
- Python 3.8+
37+
- Azure Identity credentials configured
38+
- Access to a Dataverse environment
39+
- Required packages installed from `requirements.txt`
40+
41+
## 🔒 Authentication
42+
43+
All examples use Azure Identity for authentication. Common patterns:
44+
- `DefaultAzureCredential` for development
45+
- `ClientSecretCredential` for production services
46+
- `InteractiveBrowserCredential` for interactive scenarios
47+
48+
## 📖 Documentation
49+
50+
For detailed API documentation, visit: [Dataverse SDK Documentation](link-to-docs)
51+
52+
## 🤝 Contributing
53+
54+
When adding new examples:
55+
1. Follow the existing code style and structure
56+
2. Include comprehensive comments and docstrings
57+
3. Add error handling and validation
58+
4. Update this README with your example
59+
5. Test thoroughly before submitting

examples/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""Examples package for the Dataverse SDK."""

examples/advanced/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""Advanced examples showcasing complex Dataverse SDK features."""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))
1010

1111
from dataverse_sdk import DataverseClient
12-
from dataverse_sdk.odata_pandas_wrappers import PandasODataClient
12+
from dataverse_sdk.utils.pandas_adapter import PandasODataClient
1313
from azure.identity import InteractiveBrowserCredential
1414
import traceback
1515
import requests

examples/basic/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""Basic examples for getting started with the Dataverse SDK."""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))
1111

1212
from dataverse_sdk import DataverseClient
13-
from dataverse_sdk.errors import MetadataError
13+
from dataverse_sdk.core.errors import MetadataError
1414
from enum import IntEnum
1515
from azure.identity import InteractiveBrowserCredential
1616
import traceback

src/dataverse_sdk/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
from azure.core.credentials import TokenCredential
99

10-
from .auth import AuthManager
11-
from .config import DataverseConfig
12-
from .odata import ODataClient
10+
from .core.auth import AuthManager
11+
from .core.config import DataverseConfig
12+
from .data.odata import ODataClient
1313

1414

1515
class DataverseClient:

src/dataverse_sdk/core/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""
5+
Core infrastructure components for the Dataverse SDK.
6+
7+
This module contains the foundational components including authentication,
8+
configuration, HTTP client, and error handling.
9+
"""
10+
11+
from .auth import AuthManager, TokenPair
12+
from .config import DataverseConfig
13+
from .errors import (
14+
DataverseError,
15+
HttpError,
16+
ValidationError,
17+
MetadataError,
18+
SQLParseError,
19+
)
20+
from .http import HttpClient
21+
22+
__all__ = [
23+
"AuthManager",
24+
"TokenPair",
25+
"DataverseConfig",
26+
"DataverseError",
27+
"HttpError",
28+
"ValidationError",
29+
"MetadataError",
30+
"SQLParseError",
31+
"HttpClient",
32+
]

0 commit comments

Comments
 (0)