Dataverse-Python-Advanced-Features
Dataverse-Python-Advanced-Features是一款code方向的AI技能,核心价值是# Dataverse SDK for Python - Advanced Features Guide ## Overview Comprehensive guide to advanced Dataverse SDK features including enums, complex filtering, SQL queries, metadata operations, and produ,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
# Dataverse SDK for Python - Advanced Features Guide ## Overview Comprehensive guide to advanced Dataverse SDK features including enums, complex filtering, SQL queries, metadata operations, and produ
mkdir -p ./skills/dataverse-python-advanced-features && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/dataverse-python-advanced-features/SKILL.md -o ./skills/dataverse-python-advanced-features/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# 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
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
# 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("new_priority@OData.Community.Display.V1.FormattedValue") # Returns: "High"
print(f"Priority (Raw): {priority_int}")
print(f"Priority (Formatted): {priority_formatted}")Creating Tables with Enum Columns
from enum import IntEnum
class TaskStatus(IntEnum):
NOT_STARTED = 0
IN_PROGRESS = 1
COMPLETED = 2
class TaskPriority(IntEnum):
LOW = 1
MEDIUM = 2
HIGH = 3
# Pass enum classes as column types
columns = {
"new_Title": "string",
"new_Description": "string",
"new_Status": TaskStatus, # Creates option set column
"new_Priority": TaskPriority, # Creates option set column
"new_Amount": "decimal",
"new_DueDate": "datetime"
}
table_info = client.create_table(
"new_TaskManagement",
primary_column_schema_name="new_Title",
columns=columns
)
print(f"Created table with {len(columns)} columns including enums")---
2. Advanced Filtering & Querying
Complex OData Filters
# Simple equality
filter1 = "name eq 'Contoso'"
# Comparison operators
filter2 = "creditlimit gt 50000"
filter3 = "createdon lt 2024-01-01"
# String operations
filter4 = "contains(name, 'Ltd')"
filter5 = "startswith(name, 'Con')"
filter6 = "endswith(name, 'Ltd')"
# Multiple conditions with AND
filter7 = "(name eq 'Contoso') and (creditlimit gt 50000)"
# Multiple conditions with OR
filter8 = "(industrycode eq 1) or (industrycode eq 2)"
# Negation
filter9 = "not(statecode eq 1)"
# Complex nested conditions
filter10 = "(creditlimit gt 50000) and ((industrycode eq 1) or (industrycode eq 2))"
# Using in get() calls
results = client.get("account", filter=filter10, select=["name", "creditlimit"])Retrieve with Related Records (Expand)
# Expand parent account information
accounts = client.get(
"account",
filter="creditlimit gt 100000",
expand=["parentaccountid($select=name,creditlimit)"],
select=["accountid", "name", "creditlimit", "parentaccountid"]
)
for page in accounts:
for account in page:
parent_name = account.get("_parentaccountid_value")
print(f"Account: {account['name']}, Parent: {parent_name}")SQL Queries for Complex Analysis
# SQL queries are read-only but powerful for analytics
sql = """
SELECT
a.name as AccountName,
a.creditlimit,
COUNT(c.contactid) as ContactCount
FROM account a
LEFT JOIN contact c ON a.accountid = c.parentcustomerid
WHERE a.creditlimit > 50000
GROUP BY a.accountid, a.name, a.creditlimit
ORDER BY ContactCount DESC
"""
results = client.query_sql(sql)
for row in results:
print(f"{row['AccountName']}: {row['ContactCount']} contacts")Paging with SQL Queries
# SQL queries return paginated results by default
sql = "SELECT TOP 10000 name, creditlimit FROM account ORDER BY name"
all_results = []
for page in client.query_sql(sql):
all_results.extend(page)
print(f"Retrieved {len(page)} rows")
🎯 Best For
- UI designers
- Product designers
- Claude users
- GitHub Copilot users
- Software engineers
💡 Use Cases
- Generating component mockups
- Creating design system tokens
- Python code quality enforcement
- Dependency management
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply Dataverse-Python-Advanced-Features to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Does this work with Figma?
Some design skills integrate with Figma plugins. Check the Works With section for supported tools.
Is Dataverse-Python-Advanced-Features compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for Dataverse-Python-Advanced-Features?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install Dataverse-Python-Advanced-Features?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/dataverse-python-advanced-features/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Skipping usability testing
AI-generated designs should be validated with real users before development.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.