snowflake enforce unsorted json into variant column

26 Views Asked by At

I need to insert value in a json column. and then python is reading the key from the column and creating a csv header. I need to maintain the column sequence However after loading into snowflake it seems the key is getting sorted into alphabetical order. is there a way I can enforce the order in snowflake.

Till now, this is what I have tried.

create table xyz_table(id int,json_column variant ); 
insert into xyz_table(id, json_column) select 1, parse_json($${
  "first_name": "John",
  "last_name": "Corner",
  "createddate": "2019-07-02T10:01:30+00:00",
  "type": "Owner",
  "country": {
    "code": "US",
    "name": "United States"
  }
}$$);

On selecting the table, the value of json_column is getting sorted by itself. Please suggest

0

There are 0 best solutions below