Forum: Building VoltDB Applications

Post: Seed data

Seed data
Jul 29, 2010
Is there a recommended approach to loading seed data? Is this something that can be place in the sql files? If so, does this impact how to add a cluster or change a schema?
re: Seed Data
Jul 29, 2010
Presently, the easiest way to load seed data is creating a simple file processing application (to read the row data from flat files) and calling stored procedures. Since many of these tasks will be simple 1-SQL stored procedures you can use the project definition file technique for creating them (see "3.2.3. Shortcut for Defining Simple Stored Procedures" in "Using VoltDB"). These are proper VoltDB stored procedures and called as you would a Java coded stored procedure.
As an example, if you want a simple insert stored procedure you can put the following in your project definition file (partitioninfo is optional, these can be single-partition or multi-partition):

<procedure class="MyInsert"  partitioninfo="my_table.my_column1:0"><sql>insert into my_table  (my_column1, my_column2, my_column3) values  (?,?,?);</sql></procedure>