Skip to main content
rule official · GitHub

dataverse-python-sdk — GitHub Copilot rule for Dataverse

This rule gives GitHub Copilot Python SDK examples for Dataverse, from connecting to bulk updates and file uploads. Use it while building code that works with Dataverse.

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/dataverse-python-sdk.instructions.md
Open on GitHub

What dataverse-python-sdk does

The rule covers connecting with InteractiveBrowserCredential and DataverseClient, then creating, retrieving, updating, and deleting records. Its examples also show bulk operations, paged reads, file uploads, and table metadata creation. The applyTo: '**' setting makes it apply across files.

You need a Dataverse environment with read/write access, Python 3.10+, and access to PyPI; install the package with pip install PowerPlatform-Dataverse-Client. The SDK is in preview, so that status matters when choosing it for a project. The examples include optional settings for HTTP retries, backoff, and timeout.

What it helps with

  • connect a Python client to a Dataverse environment
  • create and update Dataverse records
  • apply one update across multiple records
  • retrieve records page by page
  • upload a file to a record field

Example prompts for the agent

  • Connect a Python client to Dataverse and show how to retrieve an account by ID.
  • Create several account records, then update their telephone1 values in one call.
  • Write a paged account query that selects accountid, name, and createdon.

How to install dataverse-python-sdk

Manually: put the files in place

.github/instructions/dataverse-python-sdk.instructions.md

The applyTo field sets which files it applies to

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about dataverse-python-sdk

How do I install dataverse-python-sdk in GitHub Copilot?

Add the rule file at .github/instructions/dataverse-python-sdk.instructions.md. GitHub Copilot applies it to all files.

What does dataverse-python-sdk do?

It gives GitHub Copilot instructions and Python examples for the Dataverse SDK. The examples cover connections, CRUD, bulk work, file uploads, and table metadata.

What do I need to use the Dataverse Python SDK?

You need a Dataverse environment with read/write access, Python 3.10+, and access to PyPI. The SDK is in preview.

Source text

dataverse-python-sdk.instructions.md · MIT
---
applyTo: '**'
---
# Dataverse SDK for Python — Official Quickstart

This instruction summarizes Microsoft Learn guidance for the Dataverse SDK for Python (preview) and provides copyable snippets.

## Prerequisites
- Dataverse environment with read/write
- Python 3.10+
- Network access to PyPI

## Install
```bash
pip install PowerPlatform-Dataverse-Client
```

## Connect
```python
from azure.identity import InteractiveBrowserCredential
from PowerPlatform.Dataverse.client import DataverseClient
from PowerPlatform.Dataverse.core.config import DataverseConfig

cfg = DataverseConfig()  # defaults to language_code=1033
client = DataverseClient(
    base_url="https://<myorg>.crm.dynamics.com",
    credential=InteractiveBrowserCredential(),
    config=cfg,
)
```
- Optional HTTP settings: `cfg.http_retries`, `cfg.http_backoff`, `cfg.http_timeout`.

## CRUD Examples
```python
# Create returns list[str] of GUIDs
account_id = client.create("account", {"name": "Acme, Inc.", "telephone1": "555-0100"})[0]

# Retrieve single
account = client.get("account", account_id)

# Update (returns None)
client.update("account", account_id, {"telephone1": "555-0199"})

# Delete
client.delete("account", account_id)
```

## Bulk Operations
```python
# Broadcast patch to many IDs
ids = client.create("account", [{"name": "Contoso"}, {"name": "Fabrikam"}])
client.update("account", ids, {"telephone1": "555-0200"})

# 1:1 list of patches
client.update("account", ids, [{"telephone1": "555-1200"}, {"telephone1": "555-1300"}])

# Bulk create
payloads = [{"name": "Contoso"}, {"name": "Fabrikam"}, {"name": "Northwind"}]
ids = client.create("account", payloads)
```

## File Upload
```python
client.upload_file('account', record_id, 'sample_filecolumn', 'test.pdf')
client.upload_file('account', record_id, 'sample_filecolumn', 'test.pdf', mode='chunk', if_none_match=True)
```

## Paging Retrieve Multiple
```python
pages = client.get(
    "account",
    select=["accountid", "name", "createdon"],
    orderby=["name asc"],
    top=10,
    page_size=3,
)
for page in pages:
    print(len(page), page[:2])
```

## Table Metadata Quickstart
```python
info = client.create_table("SampleItem", {
    "code": "string",
    "count": "int",
    "amount": "decimal",
    "when": "datetime",
    "active": "bool",
})
logical = info["entity_logical_name"]
rec_id = client.create(logical, {f"{logical}name": "Sample A"})[0]
client.delete(logical, rec_id)
client.delete_table("SampleItem")
```

## References
- Getting started: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/sdk-python/get-started
- Working with data: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/sdk-python/work-data
- SDK source/examples: https://github.com/microsoft/PowerPlatform-DataverseClient-Python

© github · MIT · github/awesome-copilot

Similar IDE rules

All IDE rules for Programming languages →

From the same set732

The whole set →
dotnet-maui This rule steers Copilot toward idiomatic .NET MAUI: MVVM, CollectionView over ListView, Shell navigation. Useful once the agent starts editing XAML and C#. ★ 40,418repo stars devops-core-principles Guides GitHub Copilot on CALMS principles, DORA metrics, and delivery automation across CI/CD pipelines and infrastructure as code. ★ 40,418repo stars devbox-image-definition A GitHub Copilot rule that helps you write YAML image definition files for Microsoft Dev Box Team Customizations. Useful when your customizations rely on ~/winget, ~/gitclone and ~/powershell tasks. ★ 40,418repo stars dataverse-python A GitHub Copilot rule that tells the agent how to set up the Dataverse Python SDK: install, environment variables and OAuth. ★ 40,418repo stars dataverse-python-real-world-usecases A Copilot rule with Python templates for Dataverse migration and cleanup, so suggestions follow real integration patterns instead of generic advice. ★ 40,418repo stars dataverse-python-modules The rule hands your agent a map of PowerPlatform.Dataverse: client, config, errors, OData and SQL. Useful whenever Python code talks to Dataverse. ★ 40,418repo stars dataverse-python-file-operations Guides Python file uploads to Microsoft Dataverse via the official SDK. Handles single PATCH uploads, 4 MB chunking for files over 128 MB, and retry loops. ★ 40,418repo stars dataverse-python-error-handling Guidance for handling Dataverse SDK for Python exceptions, inspecting response codes, and deciding which failed requests are worth retrying. ★ 40,418repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor