All SkillsGet Started Free
Dataverse SDK for Python - Advanced Features Guide
Comprehensive guide to advanced Dataverse SDK features including enums, complex filtering, SQL queries, metadata operations, and production patterns. Based on official Microsoft walkthrough examples.
MCP get_skill({ skillId: "dataverse-sdk-for-python-advanced-features-guide-c8cdba5f" })Use this skill with your agent
Create a free account and connect via MCP
# Dataverse SDK for Python - Advanced Features Guide
## Overview
Comprehensive guide to advanced Dataverse SDK features including enums, complex filtering, SQL queries, metadata operations, and production patterns. Based on official Microsoft walkthrough examples.
## 1. Working with Option Sets & Picklists
### Using IntEnum for Type Safety
```python
from enum import IntEnum
from PowerPlatform.Dataverse.client import DataverseClient
# Define enum for picklist
class Priority(IntEnum):
LOW = 1
MEDIUM = 2
HIGH = 3
class Priority(IntEnum):
COLD = 1
WARM = 2
HOT = 3
# Create record with enum value
record_data = {
"new_title": "Important Task",
"new_priority": Priority.HIGH, # Automatically converted to int
}
ids = client.create("new_tasktable", record_data)
```
### Handling Formatted Values
```python
# When retrieving records, picklist values are returned as integers
record = client.get("new_tasktable", record_id)
priority_int = record.get("new_priority") # Returns: 3
priority_formatted = record.get("[email protected]") # Returns: "High"
print(f"Priority (Raw): {priority_int}")
print(f"Priority (Formatted): {priority_formatted}")
```
### Creating Tables with Enum Columns
```python
from enum import IntEnum
class TaskStatus(IntEnum):
NOT_STARTED = 0#github-copilot#structured#data#extractionpythondataverse