Excel Add-In for Azure Cosmos DB

Build 24.0.9060

JOIN Queries

The CData Excel Add-In for Azure Cosmos DB supports joins of a nested array with its parent document and joins of multiple collections.

Joining Nested Structures

The add-in expects the left part of the join is the array document you want to flatten vertically. Disable SupportEnhancedSQL to join nested Azure Cosmos DB documents. This type of query is supported through the Azure Cosmos DB API.

For example, consider the following query from Azure Cosmos DB's restaurants collection:

SELECT [restaurants].[restaurant_id], [restaurants].name, [restaurants.grades].* 
FROM [restaurants.grades]
JOIN [restaurants] 
WHERE [restaurants].name = 'Morris Park Bake Shop'
See Vertical Flattening for more details.

Joining Multiple Collections

You can join multiple collections just like you would join tables in a relational database. Set SupportEnhancedSQL to True to execute these types of joins. The following examples use the restaurants and zips collections available in the Azure Cosmos DB documentation.

The query below returns the restaurant records that exist, if any, for each ZIP code:

SELECT z.city, r.name, r.borough, r.cuisine, r.[address.zipcode]
FROM zips z
LEFT JOIN restaurants r
ON r.[address.zipcode] = z._id

The query below returns records from both tables that match the join condition:

SELECT z.city, r.name, r.borough, r.cuisine, r.[address.zipcode]
FROM restaurants r
INNER JOIN zips z
ON r.[address.zipcode] = z._id

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060