0
votes

I use copy command of snowflake which is below returns a file with content json

copy into @elasticsearch/product/sf_index from (select object_construct('id',id, alpha,'alpha')from table limit 1) file_format = (type = json, COMPRESSION=NONE), overwrite=TRUE, single = TRUE, max_file_size=5368709120;

the output in json file is

{ 
    "alpha":"alpha", 
    "id" :"1"
}

I want the order to be preserved here, not order by alphabetical ? like this

{
"id" :"1",
"alpha":"alpha",
}

any solutions?? Thanks in Advance

1
What is the need to have the attributes in any particular order? Similar to your earlier post, these seem like odd requirements for a JSON document.Mike Walton
Thanks, This requirement is removed. just now. thanksSundar

1 Answers

0
votes

It can be preserved the order if you force the data to be sorted to achieve this create primary key constrain (link) on id column and define as INT.

While loading data cast the id column as int (links )