I have a copy statement that unload from Snowflake to S3.
COPY INTO @MY_STAGE/path/my_filename FROM (
SELECT OBJECT_CONSTRUCT(*) from my_table)
FILE_FORMAT =(TYPE = JSON COMPRESSION = NONE)
OVERWRITE=TRUE;
Current result in myfilename.json
:
{
"a": 123,
"b": "def"
}
{
"a": 456,
"b": "ghi"
}
Using OBJECT_CONSTRUCT()
will produce in ndjson format. However, I want to save the file in array of json such as:
[
{
"a": 123,
"b": "def"
},
{
"a": 456,
"b": "ghi"
}
]
The data needs to be stored in one single file. I know I need to do something with SELECT OBJECT_CONSTRUCT(*) from my_table
, however I'm not sure how to transform this.