Skip to content

Instantly share code, notes, and snippets.

@remster85
Created May 12, 2020 01:10
Show Gist options
  • Save remster85/4785b2e8eb1adcbff475011e78a35085 to your computer and use it in GitHub Desktop.
Save remster85/4785b2e8eb1adcbff475011e78a35085 to your computer and use it in GitHub Desktop.
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos.errors as errors
import azure.cosmos.http_constants as http_constants
import os
import json
url = 'https://remstrava.documents.azure.com:443/'
key = ''
client = cosmos_client.CosmosClient(url, {'masterKey': key})
database_id = 'remstrava'
container_id = 'remstrava'
for item in client.QueryItems("dbs/" + database_id + "/colls/" + container_id,
'SELECT * FROM ' + container_id + ' ',
{'enableCrossPartitionQuery': True}):
item["athlete"] = "remster"
newItem = client.UpsertItem("dbs/" + database_id + "/colls/" + container_id, item)
print(json.dumps(newItem, indent=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment