An Azure service for ingesting, preparing, and transforming data at scale.
Currently, Azure Data Factory (ADF) does not support writing SQL-generated JSON objects directly to a Cosmos DB container without any mapping. When you attempt to copy the results of a SQL query that generates JSON into a Cosmos DB for NoSQL container, the JSON structure may not be preserved as expected. Instead, the JSON may be treated as a string property in the document.
To work around this limitation, you can use a two-step process:
- First Copy Activity: Use ADF to execute your SQL stored procedure to generate the JSON and write the output to an intermediary blob storage as a text file.
- Second Copy Activity: Configure another copy activity to read from the blob storage and write the JSON data to the Cosmos DB container, ensuring that the JSON structure is preserved.
This approach allows you to effectively transfer your complete JSON objects, including nested structures, into the Cosmos DB container as intended.