Skip to content

Commit 0df481d

Browse files
Merge pull request #298199 from jovanpop-msft/patch-401059
Clarifying cosmosdb parameters
2 parents 7535d75 + 06d0714 commit 0df481d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

articles/synapse-analytics/sql/query-cosmos-db-analytical-store.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,34 @@ OPENROWSET(
5050
) [ < with clause > ] AS alias
5151
```
5252

53-
The SQL connection string for Azure Cosmos DB specifies the Azure Cosmos DB account name, database name, database account master key, and an optional region name to the `OPENROWSET` function. Some of this information can be taken from the standard Azure Cosmos DB connection string.
53+
The SQL connection string for Azure Cosmos DB includes the following components:
54+
- **Account Name** - The name of the Azure Cosmos DB account you are targeting.
55+
- **Database Name** - The container name, specified without quotation marks in the OPENROWSET syntax. If the container name contains special characters (for example, a dash -), it should be enclosed in square brackets ([]).
56+
- **Region Name** (optional) - The region of your CosmosDB analytical storage. If omitted, the container's primary region is used.
57+
- **AuthType** - set this option to `ManagedIdentity` if accessing CosmosDB using the Synapse workspace Managed Identity instead of the account key.
58+
- **Key** - The master key for accessing CosmosDB data, used if not utilizing the Synapse workspace managed identity.
59+
- **Endpoint** (optional) - required if your CosmosDB account does not follow the standard `*.documents.azure.com` format.
5460

55-
Convert from the standard Azure Cosmos DB connection string format:
61+
Some of this information can be derived from the standard Azure Cosmos DB connection string:
5662

5763
```
5864
AccountEndpoint=https://<database account name>.documents.azure.com:443/;AccountKey=<database account master key>;
5965
```
6066

61-
The SQL connection string has the following format:
62-
67+
The SQL connection string can be formatted as follows:
68+
- Using the CosmosDB database account master key for authentication:
6369
```sql
6470
'account=<database account name>;database=<database name>;region=<region name>;key=<database account master key>'
6571
```
6672

67-
The region is optional. If omitted, the container's primary region is used.
68-
You can use workspace managed identity instead fo the CosmosDB account key:
69-
73+
- Using the workspace managed identity instead of the CosmosDB account key:
7074
```sql
7175
'account=<databases account name>;database=<database_name>;authtype=ManagedIdentity'
7276
```
7377

7478
> [!IMPORTANT]
7579
> There's another optional parameter in connection string called `endpoint`. The `endpoint` param is needed for accounts that don't match the standard `*.documents.azure.com` format. For example, if your Azure Cosmos DB account ends with `.documents.azure.us`, make sure that you add `endpoint=<account name>.documents.azure.us` in the connection string.
7680
77-
The Azure Cosmos DB container name is specified without quotation marks in the `OPENROWSET` syntax. If the container name has any special characters, for example, a dash (-), the name should be wrapped within square brackets (`[]`) in the `OPENROWSET` syntax.
7881

7982
### [OPENROWSET with credential](#tab/openrowset-credential)
8083

@@ -110,7 +113,7 @@ Database account master key is placed in server-level credential or database sco
110113
111114
## Sample dataset
112115

113-
The examples in this article are based on data from the [European Centre for Disease Prevention and Control (ECDC) COVID-19 Cases](/azure/open-datasets/dataset-ecdc-covid-cases) and [COVID-19 Open Research Dataset (CORD-19)](/azure/open-datasets/dataset-covid-19-open-research).
116+
The examples in this article are based on data from the [European Center for Disease Prevention and Control (ECDC) COVID-19 Cases](/azure/open-datasets/dataset-ecdc-covid-cases) and [COVID-19 Open Research Dataset (CORD-19)](/azure/open-datasets/dataset-covid-19-open-research).
114117

115118
You can see the license and the structure of data on these pages. You can also [download sample data for the ECDC](https://pandemicdatalake.blob.core.windows.net/public/curated/covid-19/ecdc_cases/latest/ecdc_cases.json) and CORD-19 datasets.
116119

@@ -256,7 +259,7 @@ FROM OPENROWSET(
256259

257260
Don't use `OPENROWSET` without explicitly defined schema because it might affect your performance. Make sure that you use the smallest possible sizes for your columns (for example `VARCHAR(100)` instead of default `VARCHAR(8000)`). You should use some UTF-8 collation as default database collation or set it as explicit column collation to avoid a [UTF-8 conversion issue](../troubleshoot/reading-utf8-text.md). Collation `Latin1_General_100_BIN2_UTF8` provides best performance when you filter data using some string columns.
258261

259-
When you query the view, you might encounter errors or unexpected results. The view references columns or objects were probably modified or no longer exist. You need to manually adjust the view definition to align with the underlying schema changes. Keep in mind that this can happen both when using automatic schema inference in the view and when explicitly specifying the schema.
262+
When you query the view, you might encounter errors or unexpected results. The view references columns or objects were probably modified or no longer exists. You need to manually adjust the view definition to align with the underlying schema changes. Keep in mind that this can happen both when using automatic schema inference in the view and when explicitly specifying the schema.
260263

261264
## Query nested objects
262265

0 commit comments

Comments
 (0)