Jump to content
  • Exporting Spotfire® Streaming Tables to CSV


    Sometimes its useful to be able to export a snapshot of a streaming table into a CSV file from Spotfire® Live Datamart. You can then take that exported CSV and load it into Spotfire® as a static dataset for analysis, or do some manipulation in Excel.

    The easiest way to do this is use the lv-client command line utility. The production documentation for this utility is available here for the latest version of Spotfire® Streaming. The utility provides a several capabilities, but to do an export to CSV we will do a snapshot query and then send it to a file. 

    1. Open a StreamBase® Command Prompt. This will open a prompt with appropriate PATH variable set to access the lv-client utility.

    2. Change the directory to the target where you would like to write the CSV file.

    3. Execute the following command, substituting in an appropriate query for the table you wish to export and the filename you wish to create

    lv-client -u lv://localhost:11080 -c "select * from EventData" > EventData.csv

    In this example the -u parameter points to the LDM server you wish to connect to, -c will produce a CSV output, and the snapshot query is between the quotes. The greater than will pipe the output to a file with the specified filename.

    If you only want a subset of the fields in the table, or wish to apply a predicate, then that can be built in to the query that you specify.

    Note that this will produce a CSV file with a summary row at the bottom like this:

    # Rows = 1262

    Depending on where you use the CSV file, the parser may ignore this line or it may cause an error, in which case it should be manually removed in a text editor before importing.


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...