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,
EntityReferenceCollection,
)
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")
# Associate
service.associate(
target=EntityReference(
entity_logical_name="new_tablename", entity_id=UUID("A_GUID")
),
related_entities=EntityReferenceCollection(
entity_logical_name="new_anothertablename",
entity_references=[
EntityReference(
entity_logical_name="new_anothertablename",
entity_id=UUID("ANOTHER_GUID"),
),
],
),
relationship_name="the_relationship_Schema_Name",
)
# Disassociate
service.disassociate(
target=EntityReference(
entity_logical_name="new_tablename", entity_id=UUID("A_GUID")
),
related_entities=EntityReferenceCollection(
entity_logical_name="new_anothertablename",
entity_references=[
EntityReference(
entity_logical_name="new_anothertablename",
entity_id=UUID("ANOTHER_GUID"),
),
],
),
relationship_name="the_relationship_Schema_Name",
)
Metadata
Release files for datapyrse 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datapyrse-0.8.0.tar.gz | 41.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datapyrse-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 99.5 kB
Release files / datapyrse-0.8.0.tar.gz
| Download URL | datapyrse-0.8.0.tar.gz |
|---|---|
| Size | 41.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aa876dcdfd47eb4015e71194732509f00188a7a92eb8e1af32021c8f1e58e33
|
|
BLAKE2b-256 checksum How to use checksums |
f202b1b163e2f1d3f52318f462a8a901788bff9e525400cf31cc0bf8b5fa86aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / datapyrse-0.8.0-py3-none-any.whl
| Download URL | datapyrse-0.8.0-py3-none-any.whl |
|---|---|
| Size | 58.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d668f23117acfd84cd4f09a3be31e6fb8fa5d263568a5e689b66d48c1dd5ed8
|
|
BLAKE2b-256 checksum How to use checksums |
3ba1f48dd2e5fd1679cc93ab4c407d0e84a6289c751ea797ef5defd3dfc9f275
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|