Skip to main content

A Dataverse client for Python

Project description

DataversePython

A Python client for interacting with Microsoft Dataverse (Dynamics 365) Web API, supporting authentication via Azure Entra ID (formerly Azure Active Directory), and providing convenient methods for querying, inserting, upserting, merging, and managing many-to-many relationships in Dataverse entities using pandas DataFrames.

Features

  • Authentication: Secure interactive login using MSAL and Azure Entra ID.
  • Querying: Retrieve entity records as pandas DataFrames with flexible filtering and column selection.
  • Insert/Upsert: Insert or upsert records from DataFrames into Dataverse entities.
  • Merge: Merge duplicate records (accounts, contacts) programmatically.
  • Many-to-Many: Manage many-to-many relationships between entities.
  • Logging: Detailed logging to DataverseClient.log for all operations and errors.

Installation

Use the following command to install this module:

pip install DataversePython

After successfully installing it into your python environment you can import the "DataverseClient" class in your code or notebook:

from DataversePython import DataverseClient

Usage

  1. Setup

    1. Create the required Azure app registration, see App Registration Guide.

    2. Add the created Service Principal (App Registration) as an application user your environments, see Add Application User Guide

    3. Create a JSON config file (see sample_config.json) with your Azure app registration and Dataverse environment details. The config JSON looks like this:

      {
      "environmentURI": "https://<your-org>.crm.dynamics.com/",
      "scopeSuffix": "user_impersonation",
      "clientID": "<your-client-id>",
      "authorityBase": "https://login.microsoftonline.com/",
      "tenantID": "<your-tenant-id>"
      }
      
  2. Basic Example

    from DataversePython.DataverseClient import DataverseClient
    import pandas as pd
    
    # Initialize client
    client = DataverseClient('sample_config.json')
    
    # Get records
    df = client.get_rows(entity='accounts', top=50, columns=['name', 'emailaddress1'], filter='revenue gt 100000')
    
    print(df.head())
    
  3. Get, Insert, Upsert, Merge, and Many-to-Many

Logging

All operations and errors are logged to DataverseClient.log in the project root. Reference this log file for troubleshooting.

Tips for Using DataversePython

  • Visualize and Explore DataFrames Easily: Install the Data Wrangler extension in VS Code to interactively view, clean, and analyze pandas DataFrames. This makes it much easier to inspect and manipulate your data when working with Dataverse records.
  • Work Interactively with Notebooks: For the best experience, use Jupyter (.ipynb) notebooks in VS Code. Notebooks allow you to run code in cells, visualize results, and document your workflow, making it ideal for data exploration and Dataverse integration tasks. Datawrangler

Resources

Below are some useful resources and documentation that were referenced during the development of this module:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataversepython-1.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataversepython-1.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file dataversepython-1.1.0.tar.gz.

File metadata

  • Download URL: dataversepython-1.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dataversepython-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9e4aadde0cbade6329173ac43177d2c0c50e91f307773cc1c355e42a6cc49244
MD5 f2a27a7b08ab1549a168afc16c0138a7
BLAKE2b-256 d2608d2c66e4928544f3f6d173018fecb0e6bde96e30e641dafff242fcbb4a32

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataversepython-1.1.0.tar.gz:

Publisher: publish.yml on fabipfr/DataversePython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dataversepython-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dataversepython-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce17962c157fe7691aa94038343d5fc4370d3c17ae222ef2b055d67f499572ab
MD5 4b9f25584a5a8cf625318fae5ba7d6a0
BLAKE2b-256 0ab502d148428b5316ff924355a188f3de941a649e8a2689bea0c29fde8f010d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataversepython-1.1.0-py3-none-any.whl:

Publisher: publish.yml on fabipfr/DataversePython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page