1 Answer
- Newest
- Most votes
- Most comments
0
Hello there,
The key is to use dot notation to access specific attributes of the struct in order to retrieve your individual values.
In your case, instead of using the syntax t.members.member0, you should use dot notation to access the specific attributes within the struct. Here's an example of how you can modify your query:
SELECT t.members.member0.timeFrames[1].id AS id,
t.members.member0.timeFrames[1].startAt AS startAt,
t.members.member0.timeFrames[1].endAt AS endAt,
t.members.member0.bufferTime AS bufferTime
FROM my_schema.my_table AS t;
Make sure to replace [1] with the appropriate index based on your data structure. The key is to use dot notation to navigate through the nested structure and access the desired values.
For further reference, you may want to take a look at this Redshift doc to Query your nested data in S3.
Hope this helps!
answered 5 months ago
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked 4 years ago
- Accepted Answerasked 6 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Hey, thanks a lot for quick response. Unfortunately, it's still not working with [index] to access array . But I do inspired by your suggestion. I further tried out different approaches. To access array inside a struct, I need to join on it. The following query works for me to access this kind of values.