Create procedure

Is it any way to  create procedures like to covert a bunch of json files to a flex table ?

Comments

  • Hi Naveen,

    Could you clarify exactly what you're trying to do?

    Generally you would use a COPY statement for this purpose.  Just give COPY the list of all files that you want to load; it will load them all automatically.  COPY supports glob expansion, too, if it's easier to do "COPY t FROM '/data/*.json'" than "COPY t FROM '/data/1.json', '/data/2.json', '/data/3.json'".

    Adam
  • Yea , thank you.
    but what if we want to make different flex table for corresponding json file.means one to one mapping. we can give the flex table name as time_stamp. 
  • Personally, for that use case, I'd suggest just loading into one big table.  Then partition by date; put views on top; etc.  Make "file_name" a column; you can do that with COPY as well, use a COPY expression and the magic builtin "current_load_source()" function.

    This would be very expensive in most databases.  In Vertica, you'll find that it works quite nicely; because of our design, it's something that we're able to do very well.

    If you really do want multiple tables, you could write a shell script to figure things out:

    https://my.vertica.com/docs/7.0.x/HTML/index.htm#Authoring/ProgrammersGuide/StoredProcedures/Creatin...

    Adam

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file