A bulk updater for Microsoft CosmosDB
Project description
CosmosDB bulk updater
A package to update a tons of documents in Microsoft CosmosDB
How it works?
It executes a query and iterate all the items executing an update function defined by the user. This query will be executed until it return any result
Usage
The sample bellow show how to add a new field into the all database documents
from cosmosdb_bulk_updater import BulkUpdater, Database
def update_document(document: dict):
document['new_field'] = 'blah'
return document
def run():
database = Database(
endpoint="[ENDPOINT]",
key="[YOUR_KEY]",
database="[DATABASE]",
collection="[COLLECTION]"
)
updater = BulkUpdater(
database=database,
query="SELECT TOP 500 VALUE c FROM c where NOT IS_DEFINED(c.new_field)"
)
updater.execute_update(
execute_fn=update_document
)
if __name__ == '__main__':
run()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cosmosdb-bulk-updater-0.5.0.tar.gz.
File metadata
- Download URL: cosmosdb-bulk-updater-0.5.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60254f329d02c6a9052f0e9c1c9cb8f061dfa9b5717f9fdad833b00ea8f5dab2
|
|
| MD5 |
78cc4808cd75cc3ccaa4fb87a74cce8e
|
|
| BLAKE2b-256 |
c012638c7f49f7495c5fa2d5f5de2a2d056698e80e2dfd1393176c7d11ee1645
|
File details
Details for the file cosmosdb_bulk_updater-0.5.0-py3-none-any.whl.
File metadata
- Download URL: cosmosdb_bulk_updater-0.5.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9465f780031bea803246c297fedd95a558e3282d46fe419bd86ec10c3f010c13
|
|
| MD5 |
f66456c897ef3c37fc5194d3519ced9e
|
|
| BLAKE2b-256 |
ff549cc139aaf960ab514e020650f7f4be63bbedfccf7b701785f81303df0d77
|