Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
[This article is prerelease documentation and is subject to change.]
In this article, we describe how to set up your Python environment to access Dataverse through the Dataverse SDK for Python. We then show some simple coding examples to get you started.
Prerequisites
- Read/write access to a Dataverse environment. A trial environment can be used.
- An activated Python 3.10+ environment.
- Network access to pypi.org to obtain the SDK packages.
Install the SDK and dependencies
From a terminal window, execute the following command. This installs the SDK from pypi.org.
pip install PowerPlatform-Dataverse-Client
Connect to Dataverse
This code example imports the client and configuration types from the SDK packages and establishes a connection to your Dataverse environment. Be sure to change 'myorg' in the URL to the correct name of your environment.
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",
InteractiveBrowserCredential(), config=cfg)
You can customize the connection using optional HTTP tunable settings to handle connection timeouts, retries, etc. Access these settings via cfg.http_retries, cfg.http_backoff, and cfg.http_timeout.
Now that you have an established client connection to a Dataverse environment, you can start using the SDK to work with business data, table metadata, and more. The next article will cover some examples of these operations.
Before you leave this page, take note that you can't work with Dataverse effectively unless you have some knowledge of Dataverse. We provide a quick guide article that teaches you the basics.