No project description provided
Project description
dataverse-api
The dataverse-api
package is an abstraction layer developed for allowing simple interaction with Microsoft Dataverse Web API.
Overview
The main goal of this project was to allow for simple upserts and inserts of data into Dataverse tables using simple and ubiquitous data structures, with use of batch requests to avoid frequent hits on the REST API. It is based on Python 3.9 to be compatible with current Python runtimes in Azure Functions.
Usage is fairly simple and assumes that a valid app registration for writing to Dataverse exists:
import os
from dataverse_api import DataverseClient
app_id = os.environ["app_id"]
authority_url = os.environ["authority_url"]
client_secret = os.environ["client_secret"]
url = os.environ["url"]
scopes = [url + "/.default"]
client = DataverseClient(
app_id=app_id,
client_secret=client_secret,
authority_url=authority_url,
scopes=scopes,
dynamics_url=url,
validate=True,
)
table = client.entity("xyz_my_table")
data = [
{"xyz_my_table_key": "Foo", "xyz_my_table_col": 1010},
{"xyz_my_table_key": "Bar", "xyz_my_table_col": 1020},
]
table.upsert(data)
Development environment
We use poetry to manage dependencies and to administrate virtual environments. To develop
dataverse-api
, follow the following steps to set up your local environment:
-
Install poetry if you haven't already.
-
Clone repository:
$ git clone git@github.com:MarcusRisanger/dataverse-api.git
-
Move into the newly created local repository:
$ cd dataverse-api
-
Create virtual environment and install dependencies:
$ poetry install
Code requirements
All code must pass black and isort style checks to be merged. It is recommended to install pre-commit hooks to ensure this locally before commiting code:
$ poetry run pre-commit install
Each public method, class and module should have docstrings. Docstrings are written in the Google style.
Testing
To produce Coverage tests, run the following commands
$ poetry run coverage run -m pytest
$ poetry run coverage xml
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
Built Distribution
Hashes for dataverse_api-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c6b139a914b337609ff7cd584a48fefcf4d9d585048b7be1028957790af11f1 |
|
MD5 | 13caf585558a94246824070957aef96f |
|
BLAKE2b-256 | 32f943676677c39bfd943d169dcbfae157f677a329feffbb121604edc1463071 |