2
votes

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?

2
See how this works for you codeproject.com/Articles/1266054/…auburg
no, they are not similar4c74356b41

2 Answers

1
votes

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.

1
votes

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.