0

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

Sundar
  • 95
  • 1
  • 13

1 Answers1

0

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 )

sandeep rawat
  • 4,797
  • 1
  • 18
  • 36