Reputation: 81
I am using the Cosmos DB SQL API. But I am confused how to migrate my existing SQL DB into Azure Cosmos DB.
Is an SQL Table similar to a Cosmos DB Container. Or do we need to store all SQL table data into one container with different Partition keys?
Upvotes: 2
Views: 3169
Reputation: 29776
Do not be fooled by the name. The Cosmos DB SQL API does not allow you to work with Cosmos DB as though it were a relational database.
It is fundamentally a JSON document database, for storing items in a container. It is schema-less. Whilst you can import data after a fashion (as @Bob linked), you don't end up with relational tables - it's all JSON documents.
The SQL API allows you to use a SQL like syntax to query the JSON structure - the semantics however, are all based on these hierarchically structured documents, allowing you to return arrays of the JSON documents or projections of them.
Queries always run in the context of a specific container.
You can't JOIN across documents for example - you use JOINs to self-join within individual documents. There is basic aggregation across documents, and some limited grouping functionality.
The semantics are very different from SQL Azure; you need to think differently.
Upvotes: 1