Skip to content

Commit d95d584

Browse files
committed
resolve merge conflict
2 parents 69ca9dc + def69c8 commit d95d584

File tree

4 files changed

+74
-16
lines changed

4 files changed

+74
-16
lines changed

articles/synapse-analytics/quickstart-connect-synapse-link-cosmos-db.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Connect to Synapse Link for Cosmos DB
3-
description: How to connect a Cosmos DB to a Synapse workspace with Synapse Link
2+
title: Connect to Synapse Link for Azure Cosmos DB
3+
description: How to connect a Azure Cosmos DB to a Synapse workspace with Synapse Link
44
services: synapse-analytics
55
author: ArnoMicrosoft
66
ms.service: synapse-analytics
@@ -24,7 +24,11 @@ Before you connect an Azure Cosmos DB account to your workspace, there are a few
2424

2525
## Enable Azure Cosmos DB analytical store
2626

27-
To run large-scale analytics into Azure Cosmos DB without impacting your operational performance, we recommend enabling Synapse Link for Azure Cosmos DB which bring HTAP capability to a container and built-in support in Azure Synapse. Follow this quickstart to enable Synapse Link for Cosmos DB containers.
27+
To run large-scale analytics into Azure Cosmos DB without impacting your operational performance, we recommend enabling Synapse Link for Azure Cosmos DB which bring HTAP capability to a container and built-in support in Azure Synapse. Follow this quickstart to enable Synapse Link for Cosmos DB containers.
28+
29+
## Navigate to Synapse Studio
30+
31+
From your Synapse workspace, select **Launch Synapse Studio**. On the Synapse Studio home page, select **Data** which will take you to the **Data Object Explorer**.
2832

2933
## Connect an Azure Cosmos DB database to a Synapse workspace
3034

@@ -37,7 +41,7 @@ From the Data Object Explorer, you can directly connect an Azure Cosmos DB datab
3741
4. Select ***Continue***
3842
5. Name the linked service. The name will be displayed in the Object Explorer and used by Synapse run-times to connect to the database and containers. We recommend using a friendly name.
3943
6. Select the **Cosmos DB account name** and **database name**
40-
7. (Optional) If no region is specified, Synapse run-time operations will be routed toward the nearest region where the analytical store is enabled. However you can set manually which region you want your users to access Cosmos DB analytical store. Select **Additional connection properties** and then **New**. Under **Property Name**, write ***PreferredRegions*** and set the **Value** to the region you want (example: WestUS2, there is no space between words and number)
44+
7. (Optional) If no region is specified, Synapse run-time operations will be routed toward the nearest region where the analytical store is enabled. However, you can set manually which region you want your users to access Cosmos DB analytical store. Select **Additional connection properties** and then **New**. Under **Property Name**, write ***PreferredRegions*** and set the **Value** to the region you want (example: WestUS2, there is no space between words and number)
4145
8. Select ***Create***
4246

4347
Azure Cosmos DB database are visible under the tab **Linked** in the Azure Cosmos DB section. You can differentiate an HTAP enabled Azure Cosmos DB container from an OLTP only container with the following icons:
@@ -56,4 +60,5 @@ By right-clicking into a container, you have list of gestures that will trigger
5660

5761
## Next steps
5862

59-
* [Learn what is supported between Synapse and Azure Cosmos DB](./synapse-link/concept-synapse-link-cosmos-db-support.md)
63+
* [Learn what is supported between Synapse and Azure Cosmos DB](./synapse-link/concept-synapse-link-cosmos-db-support.md)
64+
* [Learn how to query an analytical store with Synapse Spark](synapse-link/how-to-query-analytical-store-spark.md)

articles/synapse-analytics/synapse-link/concept-synapse-link-cosmos-db-support.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Azure Synapse Link for Cosmos DB supported features
2+
title: Azure Synapse Link for Azure Cosmos DB supported features
33
description: Understand the current list of actions supported by Azure Synapse Link for Cosmos DB
44
services: synapse-analytics
55
author: ArnoMicrosoft
@@ -26,7 +26,7 @@ You can connect to Cosmos DB container without enabling Synapse Link, in which c
2626
Here is list of the currently supported features within Synapse Link for Cosmos DB.
2727

2828
| Category | Description |[Spark](https://docs.microsoft.com/azure/synapse-analytics/sql/on-demand-workspace-overview) | [SQL serverless](https://docs.microsoft.com/azure/synapse-analytics/sql/on-demand-workspace-overview) |
29-
| :-------------------- | :----------------------------------------------------------- |:----------------------------------------------------------- | :----------------------------------------------------------- | :----------------------------------------------------------- |
29+
| -------------------- | ----------------------------------------------------------- |----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- |
3030
| **Run-time Support** |Support for read or write by Azure Synapse run-time|| [Contact Us](mailto:[email protected]?subject=[Enable%20Preview%20Feature]%20SQL%20serverless%20for%20Cosmos%20DB)|
3131
| **Cosmos DB API support** |API support as a Synapse Link| SQL / Mongo DB | SQL / Mongo DB |
3232
| **Object** |Objects such as table that can be created, pointing directly to Azure Cosmos DB container| View, Table | View |
@@ -39,7 +39,7 @@ Here is list of the currently supported features within Synapse Link for Cosmos
3939
## Supported code-generated actions for Spark
4040

4141
| Gesture | Description |OLTP |HTAP |
42-
| :-------------------- | :----------------------------------------------------------- |:----------------------------------------------------------- |:----------------------------------------------------------- |
42+
| -------------------- | ----------------------------------------------------------- |----------------------------------------------------------- |----------------------------------------------------------- |
4343
| **Load to DataFrame** |Load and read data into a Spark DataFrame |X||
4444
| **Create Spark table** |Create a table pointing to an Azure Cosmos DB container|X||
4545
| **Write DataFrame to container** |Write data into a container|||
@@ -51,12 +51,10 @@ Here is list of the currently supported features within Synapse Link for Cosmos
5151
## Supported code-generated actions for SQL serverless
5252

5353
| Gesture | Description |OLTP |HTAP |
54-
| :-------------------- | :----------------------------------------------------------- |:----------------------------------------------------------- |:----------------------------------------------------------- |
54+
| -------------------- | ----------------------------------------------------------- |----------------------------------------------------------- |----------------------------------------------------------- |
5555
| **Select top 100** |Preview top 100 items from a container|X||
5656
| **Create view** |Create a view to directly have BI access in a container through Synapse SQL|X||
5757

5858
## Next steps
5959

60-
See how to [connect to Synapse Link for Azure Cosmos DB](./how-to-connect-synapse-link-cosmos-db.md)
61-
62-
60+
See how to [connect to Synapse Link for Azure Cosmos DB](./how-to-connect-synapse-link-cosmos-db.md)

articles/synapse-analytics/synapse-link/how-to-query-analytical-store-spark.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Query Cosmos DB analytical with Synapse Spark
2+
title: Query Azure Cosmos DB analytical store with Synapse Spark
33
description: How to query Cosmos DB analytical with Synapse Spark
44
services: synapse-analytics
55
author: ArnoMicrosoft
@@ -11,7 +11,7 @@ ms.author: acomet
1111
ms.reviewer: jrasnick
1212
---
1313

14-
# Query Cosmos DB analytical with Synapse Spark
14+
# Query Azure Cosmos DB analytical store with Synapse Spark
1515

1616
This article gives some examples on how you can interact with the analytical store from Synapse gestures. Gestures are visible when you right-click on a container. With gestures, you can quickly generate code and tailor it to your needs. They are also perfect for discovering data with a single click.
1717

@@ -32,6 +32,16 @@ df = spark.read.format("cosmos.olap")\
3232
​df.show(10)
3333
```
3434

35+
The equivalent code gesture in **Scala** would be the following code:
36+
```java
37+
// To select a preferred list of regions in a multi-region Cosmos DB account, add option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
38+
39+
val df_olap = spark.read.format("cosmos.olap").
40+
option("spark.synapse.linkedService", "pySparkSamplesDb").
41+
option("spark.cosmos.container", "trafficSourceColl").
42+
load()
43+
```
44+
3545
## Create Spark table
3646

3747
In this gesture, you will create a Spark table pointing to the container you selected. That operation does not incur any data movement. If you decide to delete that table, the underlying container (and corresponding analytical store) won't be impacted.
@@ -66,6 +76,20 @@ YOURDATAFRAME.write.format("cosmos.oltp")\
6676
.save()
6777
```
6878

79+
The equivalent code gesture in **Scala** would be the following code:
80+
```java
81+
// To select a preferred list of regions in a multi-region Cosmos DB account, add option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
82+
83+
import org.apache.spark.sql.SaveMode
84+
85+
df.write.format("cosmos.oltp").
86+
option("spark.synapse.linkedService", "pySparkSamplesDb").
87+
option("spark.cosmos.container", "trafficSourceColl").
88+
option("spark.cosmos.write.upsertEnabled", "true").
89+
mode(SaveMode.Overwrite).
90+
save()
91+
```
92+
6993
## Load streaming DataFrame from container
7094
In this gesture, you will use Spark Streaming capability to load data from a container into a dataframe. The data will be stored into the primary data lake account (and file system) that you connected to the workspace.
7195

@@ -85,6 +109,21 @@ dfStream = spark.readStream\
85109
.load()
86110
```
87111

112+
The equivalent code gesture in **Scala** would be the following code:
113+
```java
114+
// To select a preferred list of regions in a multi-region Cosmos DB account, add .option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
115+
116+
val dfStream = spark.readStream.
117+
format("cosmos.oltp").
118+
option("spark.synapse.linkedService", "pySparkSamplesDb").
119+
option("spark.cosmos.container", "trafficSourceColl").
120+
option("spark.cosmos.changeFeed.readEnabled", "true").
121+
option("spark.cosmos.changeFeed.startFromTheBeginning", "true").
122+
option("spark.cosmos.changeFeed.checkpointLocation", "/localReadCheckpointFolder").
123+
option("spark.cosmos.changeFeed.queryName", "streamTestRevin2").
124+
load()
125+
```
126+
88127
## Write streaming DataFrame to container
89128
In this gesture, you will write a streaming dataframe into the Cosmos DB container you selected. If the folder */localReadCheckpointFolder* is not created, it will be automatically created. This operation will impact the transactional performance of Cosmos DB.
90129

@@ -104,6 +143,22 @@ streamQuery = dfStream\
104143
streamQuery.awaitTermination()
105144
```
106145

146+
The equivalent code gesture in **Scala** would be the following code:
147+
```java
148+
// To select a preferred list of regions in a multi-region Cosmos DB account, add .option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
149+
150+
val query = dfStream.
151+
writeStream.
152+
format("cosmos.oltp").
153+
outputMode("append").
154+
option("checkpointLocation", "/localWriteCheckpointFolder").
155+
option("spark.synapse.linkedService", "pySparkSamplesDb").
156+
option("spark.cosmos.container", "test2").
157+
option("spark.cosmos.connection.mode", "gateway").
158+
start()
159+
160+
query.awaitTermination()
161+
```
107162
## Next steps
108163

109164
* [Learn what is supported between Synapse and Azure Cosmos DB](./concept-synapse-link-cosmos-db-support.md)

articles/synapse-analytics/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@
414414
items:
415415
- name: Synapse Link
416416
items:
417-
- name: Connect to Synapse Link for Cosmos DB
417+
- name: Connect to Azure Synapse Link for Cosmos DB
418418
href: ./synapse-link/how-to-connect-synapse-link-cosmos-db.md
419-
- name: Query analytical store with Spark
419+
- name: Query Azure Cosmos DB analytical store with Synapse Spark
420420
href: ./synapse-link/how-to-query-analytical-store-spark.md
421421
- name: Synapse SQL
422422
items:

0 commit comments

Comments
 (0)