You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**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)|
31
31
|**Cosmos DB API support**|API support as a Synapse Link| SQL / Mongo DB | SQL / Mongo DB |
32
32
|**Object**|Objects such as table that can be created, pointing directly to Azure Cosmos DB container| View, Table | View |
Copy file name to clipboardExpand all lines: articles/synapse-analytics/synapse-link/how-to-query-analytical-store-spark.md
+58-2Lines changed: 58 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Query Cosmos DB analytical with Synapse Spark
2
+
title: Query Azure Cosmos DB analytical store with Synapse Spark
3
3
description: How to query Cosmos DB analytical with Synapse Spark
4
4
services: synapse-analytics
5
5
author: ArnoMicrosoft
@@ -11,7 +11,7 @@ ms.author: acomet
11
11
ms.reviewer: jrasnick
12
12
---
13
13
14
-
# Query Cosmos DB analytical with Synapse Spark
14
+
# Query Azure Cosmos DB analytical store with Synapse Spark
15
15
16
16
This article gives some examples on how you can interact with the analytical store from Synapse gestures. Those gestures are visible when you right-click on a container. With gestures, you can quickly generate code and tweak it to your needs. They are also perfect for discovering data with a single click.
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. This scenario is convenient to reuse tables through third-party tools and provide accessibility to the data for the run-time.
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. If the folder /localReadCheckpointFolder is not created, it will be automatically created. This operation will impact the transactional performance of Cosmos DB.
65
89
@@ -77,6 +101,21 @@ dfStream = spark.readStream\
77
101
.load()
78
102
```
79
103
104
+
The equivalent code gesture in **Scala** would be the following code:
105
+
```java
106
+
// To select a preferred list of regions in a multi-region Cosmos DB account, add .option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
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.
82
121
@@ -94,4 +133,21 @@ streamQuery = dfStream\
94
133
.start()
95
134
96
135
streamQuery.awaitTermination()
136
+
```
137
+
138
+
The equivalent code gesture in **Scala** would be the following code:
139
+
```java
140
+
// To select a preferred list of regions in a multi-region Cosmos DB account, add .option("spark.cosmos.preferredRegions", "<Region1>,<Region2>")
0 commit comments