Akhil Tyagi
Akhil Tyagi

Reputation: 81

Is a SQL Azure Table similar to an Azure Cosmos DB Container?

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

Answers (2)

James World
James World

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

Bob Ash
Bob Ash

Reputation: 887

Cosmos DB Data Migration tool can be used to import data from SQL Server into Cosmos DB. Refer this link

A Cosmos DB Container is not similar to a SQL Server Table. You can import data from multiple tables in a database into a single Cosmos DB container.

Upvotes: 0

Related Questions