Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.
SOLVED

nested arrays using sql query insertion to a dataset not working

Avatar

Level 2

I am trying to insert nested arrays output from a sql query into another dataset but it is not working.

 

insert into b_array_processed_data_testing(_spnam.profileIds.B_UID,_spnam.arrayOfObjects)
SELECT
b_array.UID,
b_array.arrayOfObjects
FROM
(WITH grouped_data AS (
SELECT
_spnam.profileIds.B_UID as UID,
ARRAY_AGG(STRUCT(_spnam.arrayOfObjects.coolestInt,_spnam.arrayOfObjects.FavDessert)) AS arrayOfObjects
FROM
b_array_staging_poc_testing
GROUP BY
_spnam.profileIds.B_UID
)
SELECT
UID,
arrayOfObjects
FROM
grouped_data;)b_array

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@RitwikMoWhen you are working with complex data structure (array's) you will need to use the collect_set function to write data into the array of the target schema dataset.

 

https://experienceleague.adobe.com/en/docs/experience-platform/query/key-concepts/nested-data-struct...

 

~cheers,

Naresh Nakirikanti.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@RitwikMoWhen you are working with complex data structure (array's) you will need to use the collect_set function to write data into the array of the target schema dataset.

 

https://experienceleague.adobe.com/en/docs/experience-platform/query/key-concepts/nested-data-struct...

 

~cheers,

Naresh Nakirikanti.