Load Flex Table data from another table

Hi,

Instead of loading from a file with JSON data, is there a way to read in the json data from another table that his it in a LONG VARCHAR field?

Comments

  • Hi TrovadorSF,

     

    Thanks for your interest in Flex!

     

    Currently the only way to add data to a Flex table is with a COPY statement. UPDATE and INSERT are not available, and therefore you aren't able to use "INSERT SELECT" statements either.

     

    We're working on it!

     

    In the meantime, you can export your data in delimited format from an existing table and load it back into flex. Like so:

     

    vsql -A -c 'select * from my_table;' | tail -n-1 > /tmp/data.delimited

     

    • -A drops "alignment" in output
    • tail -n-1 removes the last row (the row count)

     

    vsql -c "copy my_flex from '/tmp/data.delimited' parser fdelimitedparser()"

     

    (Note: I didn't run these commands, but they show the gist of what you'd want to use. Sorry if there are small errors.)

     

    If the pipe character ("|") is not a safe delimiter, be sure to change the record separator in vsql and in fdelimitedparser. Both of options for doing so.

     

    - Derrick

  • Hi Derrick,

    I'm wondering if there has been any update on loading JSON data in from another table?

Leave a Comment

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