Azure Synapse Analytics: Unexpected null Value when Querying Array from CosmosDB
Finn Schmidt
86
Reputation points
Hello,
I am working with the analytical store for CosmosDb, via Synapse Link. In CosmosDB i have json documents with (roughly) the following structure
{
"ID": 123,
"...": "...",
"items": [
{
"itemId": 1,
"...": "..."
}
]
}
When i try to query this dataset in the analytical store in synapse, via
Select ID, items
FROM OPENROWSET( PROVIDER = 'CosmosDB', CONNECTION = "...", ...)
The items column returns arrays with a prepended null value, such as:
[
null,
{
"itemId": 1,
"...": "..."
}
]
which, when using CROSS APPLY OPENJSON(items) to parse the items array into a tabular structure creates duplicated rows.
Of course I can simply remove those duplicated rows, but i don't understand where this null value is coming from in the first place.
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,322 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,851 questions
Sign in to answer