Table of Contents

Load Data

Loads data from a CSV file into an existing table. A value of NULL in a cell will be converted to a database NULL rather than the string “NULL”

Since LiquiBase 1.7

Sample

<loadData tableName="users" file="com/sample/users.csv">
    <column name="id" type="NUMERIC"/>
    <column name="firstname" type="STRING"/>
    <column name="lastname" type="STRING"/>
    <column name="username" type="STRING"/>
</loadData>

Available Attributes

tableName Name of the table to insert data into [required]
schemaName Name of the table schema
file CSV file to load [required]
encoding Encoding of the CSV file (defaults to UTF-8)

Available Sub-Tags

column Defines how the data should be loaded

Available Column Attributes

index A zero-based index of the column being described [index or header required]
header Data file header row value of column being described [index or header required]
name Name of the column to insert into. Defaults to the header value in the file
type Data type of the column. Possible values: STRING, NUMERIC, DATE, BOOLEAN [required]

Database Compatiblity

MySQL No Issues
PostgreSQL No Issues
Oracle No Issues
MS-SQL No Issues
Sybase No Issues
DB2 No Issues
Derby No Issues
HSQL No Issues
H2 No Issues
Caché No Issues
Firebird No Issues
MaxDB No Issues
SQLite No Issues

Automatic Rollback Support: NO