I have a csv file in which there is 1 column with nested format. Something looks like this:
| id | type | detail |
|---|---|---|
| 1 | free | {"type":{"limits":{"account":10,"sub":{"term":"month"},"campaigns":{"act":10}}}}} |
I want to load this file stored in S3 into Redshift and use "SUPER" as the data type for detail column.
The query i'm using is:
CREATE TABLE test
(id smallint
type varchar(10)
detail super)
diststyle auto
and here is the copy statement (in aws documentation, there's not much mentioned about parsing data to super type):
copy stage.test
from 's3://.../test.csv'
region 'us-east-1' iam_role 'arn:aws:iam::xxxxxxx:role/redshift-role'
ignoreheader 1
format CSV
;
i could load the data alright, but the SUPER column doesn't seem to be parse correctly. The result in that column looks like a string and i can't unnest it to query the components.
Could someone please tell me where i went wrong?