azure-cosmosdb

How is cosmosDB RU throughput enforced

强颜欢笑 提交于 2021-02-02 09:35:45
问题 I have a cosmosGB gremlin API set up with 400 RU/s. If I have to run a query that needs 800 RUs, does it mean that this query takes 2 sec to execute? If i increase the throughput to 1600 RU/s, does this query execute in half a second? I am not seeing any significant changes in query performance by playing around with the RUs. 回答1: As I explained in a different, but somewhat related answer here, Request Units are allocated on a per-second basis. In the event a given query will cost more than

Getting/resetting Azure Cosmos DB Master Keys Programmatically

点点圈 提交于 2021-01-29 20:48:11
问题 I am trying to get and reset the master keys for an Azure Cosmos DB account from code, specifically from C# code in an Azure Function App whose system assigned managed identity has an RBAC role defined on the Cosmos DB account. The Cosmos DB client api does not appear to have this functionality. 回答1: Here is an example on how to generate the master key from the github repo. private static string GenerateMasterKeyAuthorizationSignature(string verb, string resourceId, string resourceType,

group data by same timestamp using cosmos db sql

牧云@^-^@ 提交于 2021-01-29 18:54:25
问题 Question: I am trying SQL query as the image showed below,I want it to be grouped by the same timestamp expected output: [ { "tag1": { "TagName": "PV1-input-power-L(10W)", "Value": 0 }, "tag2": { "TagName": "Sunshine-Display-Value", "Value": 0 }, "tag3": { "TagName": "TotalEnergy-(100kWh)_1", "Value": 0 }, "timestamp": "2020-03-27T02:40:18Z" } ] sample document: 回答1: You can use User Defined Functions. Here is the data from my containers Here is the function I have created. I named it

Gremlin for CosmosDB - Cannot create ValueField on non-primitive type GraphTraversal

谁说胖子不能爱 提交于 2021-01-29 18:34:32
问题 I'm trying to execute a query but facing this error. Below query is the simplest form of what I was trying to achieve. g.V('Users12345').as('u'). project('id', 'email', 'test'). by('id'). by('emailId'). by(where(values('id').is(eq(select('u').values('id'))))) I was trying to use select inside project. What's that I'm missing here? 回答1: The invalid part is eq(select('u').values('id')) . I guess "the query in its simplest form" means that you're aware of it being pointless. Assuming that u is

Why would I ever want to explicitly include a PartitionKey when upserting an item with CosmosClient?

主宰稳场 提交于 2021-01-29 13:13:09
问题 UpsertItemAsync has an optional parameter where you can indicate the PartitionKey . This is for the 'new' CosmosClient and not for the 'old' DocumentClient. https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.container.upsertitemasync?view=azure-dotnet As the documentation says - it is optional because if you do not supply one, it will be automatically extracted from the item. Isn't that perfect? Is there any conceivable situation under any circumstances where that is not what

Gremlin Python SDK for Azure CosmosDB

断了今生、忘了曾经 提交于 2021-01-29 12:31:04
问题 The documentation on the Azure site for CosmoDB & Gremlin & Python[1][2][3] use bad practices - tons of code duplication and concatenating strings to form queries, rather than using native python. However, when trying to use the native SDK, there's a 2 year old bug that prevents it due to serialization errors[4]. What's the best way to use Gremlin & Python with CosmosDB? Should I give up on Gremlin altogether - and if so, what's the alternative solution? [1] https://docs.microsoft.com/en-us

How to connect to azure SQL server using visual studio

∥☆過路亽.° 提交于 2021-01-29 08:46:02
问题 I have an azure function triggered by Cosmos DB. I am getting the data from the JSON file and send it over to my SQL database on Azure. I wanted to know if I can connect directly to the Azure SQL using my Visual Studio? I have connected to it once through the portal, but I can't see that I am connected to my database under View/Cloud Explorer in Visual Studio. The database is only listed under View/SQL Server Object Explorer . I assume this connection is through my local machine, and not

IOTHubMessage.forEach is not a function?

狂风中的少年 提交于 2021-01-29 08:04:17
问题 Can anyone tell me how to parse this problem? I have an thrown error message that when i create azure cosmossDB, my cosmosDB output binding thrown message that IOTHubMessage.forEach is not a function; module.exports = function (context, IoTHubMessages) { context.log(`JavaScript eventhub trigger function called for message array: ${IoTHubMessages}`); var count = 0; var totalTemperature = 0.0; var totalHumidity = 0.0; var deviceId = "*****"; IoTHubMessages.forEach(message => { context.log(

Azure cosmos db bulk import

China☆狼群 提交于 2021-01-28 20:20:22
问题 Is bulk import available for Azure cosmos db(Mongo db API)? I want to import large dataset set which is available in a json file to Azure cosmos for Mongo DB. I tried importing using mongoimport and Java mongo APIs but it took a long time and timed out in the end. Any suggestions on how to import it directly from my file to cosmos db? PS: https://docs.microsoft.com/en-us/azure/cosmos-db/bulk-executor-java --- says bulk executor is not available for cosmos's mongo db yet. 回答1: Bulk executor

Substitute for having clause in CosmosDB

最后都变了- 提交于 2021-01-28 18:48:10
问题 I have the following result from a query, where count field is derived from an aggregate function [ { "count": 1, "facilityName": "Hyundai Service Center" }, { "count": 2, "facilityName": "Honda Service Center" }, { "count": 1, "facilityName": "Kat Service Center" } ] I want to display only those facilityName where count >= 2. How can we achieve this? 回答1: I tried to implement your requirement with Stored procedure,please refer to my SP code: function sample(idArray) { var collection =