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.messages 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.entities
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
Release history Release notifications | RSS feed
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.2.tar.gz
(36.7 kB
view details)
Built Distribution
datapyrse-0.6.2-py3-none-any.whl
(53.6 kB
view details)
File details
Details for the file datapyrse-0.6.2.tar.gz
.
File metadata
- Download URL: datapyrse-0.6.2.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53b737495afb90226cbe5c5900cb9213620569d8e37297cc5d62b29c0085f844 |
|
MD5 | 6b8a88c325ce5f8d1b310938dbbff59d |
|
BLAKE2b-256 | 565fdefe592ae7dd988bb27d7e97c3df659319617a9c34b29332d1925f2c52b9 |
File details
Details for the file datapyrse-0.6.2-py3-none-any.whl
.
File metadata
- Download URL: datapyrse-0.6.2-py3-none-any.whl
- Upload date:
- Size: 53.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03876cd176297d8ed45c40db446e4aa6245718fda202980b93499577f7890cfd |
|
MD5 | 62fa66a61caa7ca06f4a1687fa9d9b4e |
|
BLAKE2b-256 | fb41f1bee1178ba41c2d6f09d22e64411acc286d6b93145ee51be335058d67ea |