Skip to main content

Create Flex Table

  • March 28, 2014
  • 2 replies
  • 15 views

Naveen_Kumar
Forum|alt.badge.img+1
Hi,
I am working on flex table.
i have to load data using json files. 
can i create a flex table like -
Create flex table flexTable(key1 timestamp default key2::tiestamp);
copy flexTable from 'path/file.json' parser fjsonparser();
?

2 replies

Forum|alt.badge.img+2
  • Participating Frequently
  • March 28, 2014
Hi Naveen,

I unfortunately don't know the answer offhand; I would suggest that you create some example data and try it :-)

If it doesn't work, you could try replacing "key2" with a map-extract expression; something like "map_lookup(__raw__, 'key1')":

Create flex table flexTable(key1 timestamp default map_lookup(__raw__, 'key2')::timestamp);

Uglier, but, means the same thing.  (The "__raw__" column and the "map_lookup()" function are described in the Flex documentation.)

Note that this will error out if 'key2' doesn't contain a valid timestamp.

Adam

Naveen_Kumar
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • March 28, 2014
Hi Adam,
Thanks for you response.
I tried many queries with default key but its not working , it is not assigning the default value. 
Can u check it for me?
and can u tell me one thing , Is there any way to check constraint violations on flex table.
I posted a question related to discard duplicate data in flex table, but unfortunately i didn't get any reply.

Thanks again .

Regards
Naveen