Search code examples
csvubuntu-16.04sqlcmdvoltdb

How to load csv file into voltDB?


I'm very new to voltDB, how to load CSV file into voltDB table?

I tried this command: (sqlcmd> csvloader testing -f '/home/ex.csv';)

..but I receive the following error:

Unexpected Ad Hoc Planning Error: java.lang.RuntimeException: Error compiling query: org.voltdb.planner.PlanningErrorException: SQL Syntax error in "csvloader testing -f 'home/ex.csv'" unexpected token: CSVLOADER


Solution

  • It looked like that you were trying to use SQLCmd to load the csv file. SQLCmd is an interactive command prompt for issuing SQL to VoltDB. The commands it takes are listed on this page in the documentation.

    To load a CSV file into a table, first make sure that the content in the CSV file match the schema of the table defined in VoltDB. You can then use the csvloader tool to bulk load the file into the database. Since the csvloader is a standalone program located in the bin/ directory in the VoltDB kit, start it directly from the command line, not from the SQLCmd prompt. For example, assuming that the VoltDB database is running on your local machine with default port configuration, you can use the following command to load the CSV file.

    $ csvloader testing -f '/home/ex.csv'
    

    For more options of the csvloader, please refer to this page.