Git Product home page Git Product logo

azure-cosmos-db-partition-key-advisor's Introduction

Partition Key Advisor

Data analyzing tool for helping customers choose the best partition key for their Cosmos DB collections.

Features

This project framework provides the following features:

  • Schema discovery and cardinality assesment
  • Display of storage distribution based on logical partition keys
  • Display of distinctness of keys at a given second
  • Recommendation based on cardinality, distinctness/sec and storage distribution for write-heavy workloads

Getting Started

Before you can run this sample, you must have the following prerequisites:

  • Visual Studio
  • Azure SDK for Visual Studio
  • .NET Core 2.2. SDK

From Visual Studio, open the PartitionKeyAdvisor.sln file from the root directory.

In Visual Studio Build menu, select Build Solution (or Press F6).

You can substitute the endpoint and primary key in the appsettings.json with your Cosmos DB account values including the endpointUri and primary key information.

You can now run and debug the application locally by pressing F5 in Visual Studio.

Demo

This demo is included to show you how to use the project.

To run the demo using existing configurations, follow these steps:

  1. Build project as stated above, and add your connection string/keys found in your Azure Account.
  2. To test a collection: run it on a DatabaseID and CollectionID of your choosing.
  3. For candidate partition keys, choose partition keys available within your collection: ex."make_id", "make_is_common", "make_country".

azure-cosmos-db-partition-key-advisor's People

Contributors

aliuy avatar luisbosquez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-cosmos-db-partition-key-advisor's Issues

Exception {"Can not convert Object to String."} when running against cosmos

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report ->
Getting the following error when submitting request  : 
"   at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)\r\n   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)\r\n   at Newtonsoft.Json.Linq.JToken.ToObject[T]()\r\n   at Microsoft.Azure.Documents.JsonSerializable.GetValue[T](String propertyName)\r\n   at PartitionKeyAdvisor.Controllers.HomeController.<>c__DisplayClass9_0.<WriteHeavy>b__1(Document x) in C:\\repos\\azure-cosmos-db-partition-key-advisor\\PartitionKeyAdvisor\\Controllers\\HomeController.cs:line 137\r\n   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer) in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Lookup.cs:line 96\r\n   at System.Linq.GroupedEnumerable`2.GetEnumerator() in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Grouping.cs:line 255\r\n   at System.Linq.Set`1.UnionWith(IEnumerable`1 other) in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Set.cs:line 206\r\n   at System.Linq.Enumerable.DistinctIterator`1.FillSet() in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Distinct.cs:line 96\r\n   at System.Linq.Enumerable.DistinctIterator`1.GetCount(Boolean onlyIfCheap) in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Distinct.cs:line 103\r\n   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source) in E:\\A\\_work\\322\\s\\corefx\\src\\System.Linq\\src\\System\\Linq\\Count.cs:line 46\r\n   at PartitionKeyAdvisor.Controllers.HomeController.<WriteHeavy>d__9.MoveNext() in C:\\repos\\azure-cosmos-db-partition-key-advisor\\PartitionKeyAdvisor\\Controllers\\HomeController.cs:line 137"

Minimal steps to reproduce

try to run the project

Any log messages given by the failure

Expected/desired behavior

OS and Version?

windows 10

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Get advice on keys that are single children of single parent in JSON

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Assume the following JSON

{
  dateSubmitted: ....,
  contactEmail: test@domain.com,
  headerInformation: {
    sourceId: 1,
    sourceName: "cool source",
    sourceAddress: {
      street: "123 Street st",
      city: "North Birminghamshireton",
      postal: "12345",
      country: "Canada"
    }
  }
  otherAttributes: ...
}

Expected/desired behavior

I would like to be able to see the feasibility of using "headerInformation/sourceId" or "/headerInformation/sourceAddress/postal" as my partition key

Documents with properties that are complex objects fail

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Create a collection in Cosmos with at least one complex type... e.g. a Person document with a complex property for Name:

public class Person
    {
        public Guid Id { get; set; }
        public DateTime DateOfBirth  { get; set; }
        public PersonName Name { get; set; }
        public string Alias { get; set; }
...
    }

public class PersonName
    {
        public string FirstName  { get; set; }
        public string MiddleInitial { get; set; }
        public string LastName { get; set; }
...
    }

etc., etc.

Any log messages given by the failure

Line 136 throws an exception that the property is not of type string

Expected/desired behavior

Omit non-primitive properties from consideration

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
macOS Mojave

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

How to run?

I followed the instructions from readme in Visual Studio 2022, but nothing happens when I try to run the demo. Solution is built successfully. I see no .exe files inside the solution folder, but only .dll. The same happens in Visual Studio 2019.

Getting error "Error. An error occurred while processing your request. Please try again with valid inputs."

AzurePartiotionAdvisoInput

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

2

Any log messages given by the failure

AzurePartiotionAdvisoInput
AzurePartitionAdvisorError

Yes

Expected/desired behavior

Throwing "Error.
An error occurred while processing your request. Please try again with valid inputs."

OS and Version?

Windows 10

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.