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. Insert, Upsert, Merge, and Many-to-Many

    • See docstrings in DataverseClient.py for details on each method.

Logging

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

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.0.0.tar.gz (8.0 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.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dataversepython-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8fb8f3bf2744445e99a00a77ac1256d8f1885dab1ee20bf55032d9a5a3db41bf
MD5 fc08850ad32ac3591d8a04ad5fd573ef
BLAKE2b-256 39c2b28d3d31639cc39215387c459fb7f7b3108ab2a3011c0d8cc35b100834cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataversepython-1.0.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.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dataversepython-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe2140d6ab027ec8d75d5c867e211ed25899c1479cf735b118fd591fb5139cd
MD5 c0fd334ea80057f54a71bbf07c039ff4
BLAKE2b-256 22b7b9bd70b7aa33dbf60833829f6a159e88aa98c3ad77aba80c016ed445235c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataversepython-1.0.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