Skip to main content

A package used to mimic the functionality of the Dataverse SDK.

Project description

datapyrse

Overview

datapyrse is a Python library designed to mimic the functionality of the Microsoft Dataverse SDK

Features

  • Data Retrieval: Easily retrieve data from Dataverse entities.
  • Data Manipulation: Perform CRUD operations on Dataverse data.
  • Query Building: Build complex queries to filter and sort data.
  • Integration: Seamlessly integrate with other data processing libraries.

Installation

To install datapyrse, use pip:

pip install datapyrse

Usage

from uuid import UUID
import sys
from datapyrse import (
    ServiceClient,
    Entity,
    EntityCollection,
    EntityReference,
)
from datapyrse.query import QueryExpression, ColumnSet
from datapyrse.services import (
    RetrieveMultipleResponse,
    RetrieveResponse,
    CreateResponse,
    DeleteResponse,
)


service: ServiceClient = ServiceClient(
    tenant_id="YOUR_TENANT_ID",
    resource_url="YOUR_RESOURCE_URL",  # e.g. https://yourorg.crm.dynamics.com
)
if not service.is_ready:
    print("Service not ready")
    sys.exit(1)


# Retrieve multiple entities
query: QueryExpression = QueryExpression(
    "new_tablename", ColumnSet(["new_name", "ownerid"])
)
rm_response: RetrieveMultipleResponse = service.retrieve_multiple(query)
entities: EntityCollection = rm_response.entity_collection

if entities.entities:
    for ent in entities.entities:
        print(f"\nId: {ent.entity_id}")
        for attribute in ent.attributes:
            print(f"  {attribute}: {ent.attributes[attribute]}")
        print()

# Retrieve a single entity
r_response: RetrieveResponse = service.retrieve(
    "new_tablename", UUID("YOUR_GUID"), ColumnSet(["new_name", "ownerid"])
)
entity: Entity = r_response.entity

# Create a new entity
new_entity: Entity = Entity("new_tablename")
new_entity["new_name"] = "New Entity"

user_id: UUID = UUID("USER_GUID")
new_entity["ownerid"] = EntityReference("systemuser", user_id)

c_response: CreateResponse = service.create(new_entity)
if c_response.entity.entity_id:
    new_entity_id: UUID = c_response.entity.entity_id

# Delete an entity
d_response: DeleteResponse = service.delete(
    entity_logical_name="new_tablename", entity_id=UUID("YOUR GUID")
)
if d_response.was_deleted is True:
    print("Entity deleted")

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

datapyrse-0.6.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

datapyrse-0.6.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file datapyrse-0.6.1.tar.gz.

File metadata

  • Download URL: datapyrse-0.6.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for datapyrse-0.6.1.tar.gz
Algorithm Hash digest
SHA256 a3abdef5b7b28313dfde47729fc58558392efd1d03b7483c74d771c35816938a
MD5 a440751dff30286045613659c5d38427
BLAKE2b-256 aeba5063bd1b790dff48403b93c9c978a0ed4dbff5fefd60bf1b9805d4939531

See more details on using hashes here.

File details

Details for the file datapyrse-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: datapyrse-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for datapyrse-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c2b534444651b7a0d9547b0a3ee466205ad6195523a39950f8dafe76bbc54e
MD5 352f9b0edfc4f62f3081ed873a3d6a0b
BLAKE2b-256 a51cf14e016af547328818d77ae065b6a590440698e95011da00816116903d7b

See more details on using hashes here.

Supported by

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