datapyrse


Namedatapyrse JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryA package used to mimic the functionality of the Dataverse SDK.
upload_time2024-10-01 18:09:33
maintainerNone
docs_urlNone
authorBlake Bradford
requires_python>=3.12
licenseMIT License Copyright (c) 2024 blakeZTL Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dataverse power platform microsoft sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```sh
pip install datapyrse
```

## Usage
```py
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",
)

```



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "datapyrse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "Dataverse, Power Platform, Microsoft, SDK",
    "author": "Blake Bradford",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f2/02/b1b163e2f1d3f52318f462a8a901788bff9e525400cf31cc0bf8b5fa86aa/datapyrse-0.8.0.tar.gz",
    "platform": null,
    "description": "# datapyrse\n\n## Overview\n`datapyrse` is a Python library designed to mimic the functionality of the Microsoft Dataverse SDK\n\n## Features\n- **Data Retrieval**: Easily retrieve data from Dataverse entities.\n- **Data Manipulation**: Perform CRUD operations on Dataverse data.\n- **Query Building**: Build complex queries to filter and sort data.\n- **Integration**: Seamlessly integrate with other data processing libraries.\n\n## Installation\nTo install `datapyrse`, use pip:\n\n```sh\npip install datapyrse\n```\n\n## Usage\n```py\nfrom uuid import UUID\nimport sys\nfrom datapyrse import (\n    ServiceClient,\n    Entity,\n    EntityCollection,\n    EntityReference,\n    EntityReferenceCollection,\n)\nfrom datapyrse.query import QueryExpression, ColumnSet\nfrom datapyrse.messages import (\n    RetrieveMultipleResponse,\n    RetrieveResponse,\n    CreateResponse,\n    DeleteResponse,\n)\n\n\nservice: ServiceClient = ServiceClient(\n    tenant_id=\"YOUR_TENANT_ID\",\n    resource_url=\"YOUR_RESOURCE_URL\",  # e.g. https://yourorg.crm.dynamics.com\n)\nif not service.is_ready:\n    print(\"Service not ready\")\n    sys.exit(1)\n\n\n# Retrieve multiple entities\nquery: QueryExpression = QueryExpression(\n    \"new_tablename\", ColumnSet([\"new_name\", \"ownerid\"])\n)\nrm_response: RetrieveMultipleResponse = service.retrieve_multiple(query)\nentities: EntityCollection = rm_response.entities\n\nif entities.entities:\n    for ent in entities.entities:\n        print(f\"\\nId: {ent.entity_id}\")\n        for attribute in ent.attributes:\n            print(f\"  {attribute}: {ent.attributes[attribute]}\")\n        print()\n\n# Retrieve a single entity\nr_response: RetrieveResponse = service.retrieve(\n    \"new_tablename\", UUID(\"YOUR_GUID\"), ColumnSet([\"new_name\", \"ownerid\"])\n)\nentity: Entity = r_response.entity\n\n# Create a new entity\nnew_entity: Entity = Entity(\"new_tablename\")\nnew_entity[\"new_name\"] = \"New Entity\"\n\nuser_id: UUID = UUID(\"USER_GUID\")\nnew_entity[\"ownerid\"] = EntityReference(\"systemuser\", user_id)\n\nc_response: CreateResponse = service.create(new_entity)\nif c_response.entity.entity_id:\n    new_entity_id: UUID = c_response.entity.entity_id\n\n# Delete an entity\nd_response: DeleteResponse = service.delete(\n    entity_logical_name=\"new_tablename\", entity_id=UUID(\"YOUR GUID\")\n)\nif d_response.was_deleted is True:\n    print(\"Entity deleted\")\n\n# Associate\nservice.associate(\n    target=EntityReference(\n        entity_logical_name=\"new_tablename\", entity_id=UUID(\"A_GUID\")\n    ),\n    related_entities=EntityReferenceCollection(\n        entity_logical_name=\"new_anothertablename\",\n        entity_references=[\n            EntityReference(\n                entity_logical_name=\"new_anothertablename\",\n                entity_id=UUID(\"ANOTHER_GUID\"),\n            ),\n        ],\n    ),\n    relationship_name=\"the_relationship_Schema_Name\",\n)\n\n# Disassociate\nservice.disassociate(\n    target=EntityReference(\n        entity_logical_name=\"new_tablename\", entity_id=UUID(\"A_GUID\")\n    ),\n    related_entities=EntityReferenceCollection(\n        entity_logical_name=\"new_anothertablename\",\n        entity_references=[\n            EntityReference(\n                entity_logical_name=\"new_anothertablename\",\n                entity_id=UUID(\"ANOTHER_GUID\"),\n            ),\n        ],\n    ),\n    relationship_name=\"the_relationship_Schema_Name\",\n)\n\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 blakeZTL  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A package used to mimic the functionality of the Dataverse SDK.",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/blakeZTL/datapyrse"
    },
    "split_keywords": [
        "dataverse",
        " power platform",
        " microsoft",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ba1f48dd2e5fd1679cc93ab4c407d0e84a6289c751ea797ef5defd3dfc9f275",
                "md5": "bfd8941c0d01afa71b7c6c0831fac8ea",
                "sha256": "5d668f23117acfd84cd4f09a3be31e6fb8fa5d263568a5e689b66d48c1dd5ed8"
            },
            "downloads": -1,
            "filename": "datapyrse-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bfd8941c0d01afa71b7c6c0831fac8ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 58493,
            "upload_time": "2024-10-01T18:09:31",
            "upload_time_iso_8601": "2024-10-01T18:09:31.931521Z",
            "url": "https://files.pythonhosted.org/packages/3b/a1/f48dd2e5fd1679cc93ab4c407d0e84a6289c751ea797ef5defd3dfc9f275/datapyrse-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f202b1b163e2f1d3f52318f462a8a901788bff9e525400cf31cc0bf8b5fa86aa",
                "md5": "fffd7f51b9a9530825e6d564eba2da84",
                "sha256": "5aa876dcdfd47eb4015e71194732509f00188a7a92eb8e1af32021c8f1e58e33"
            },
            "downloads": -1,
            "filename": "datapyrse-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fffd7f51b9a9530825e6d564eba2da84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 40991,
            "upload_time": "2024-10-01T18:09:33",
            "upload_time_iso_8601": "2024-10-01T18:09:33.405805Z",
            "url": "https://files.pythonhosted.org/packages/f2/02/b1b163e2f1d3f52318f462a8a901788bff9e525400cf31cc0bf8b5fa86aa/datapyrse-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-01 18:09:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blakeZTL",
    "github_project": "datapyrse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "datapyrse"
}
        
Elapsed time: 1.15064s