Discussion:
[Liquibase-user] New Topic: Loading data from CSV into HSQLDB with a sequence
Liquibase Community Forum
2011-01-19 22:27:35 UTC
Permalink
A new topic, 'Loading data from CSV into HSQLDB with a sequence', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=956.new#new

The text of the topic is shown below:

I'm attempting to load some data into an HSQLDB database using Liquibase 1.9.5. I have a loadData command as follows:
Code:
<loadData tableName="LIST_ITEM_TYPE" file="data/global/list_item_type.csv">
<column name="ID" type="NUMERIC" />
<column name="NAME" type="STRING" />
<column name="DESCRIPTION" type="STRING" />
</loadData>

In my CSV data file I'm attempting to set the ID value to the next value from an existing sequence:
Code:
id,name,description
next value for SEQ_ITEM_TYPE_ID,Test Name,A test description

However, this doesn't work as it generates the following SQL:
Code:
INSERT INTO LIST_ITEM_TYPE (id, description, name) VALUES ('next value for SEQ_ITEM_TYPE_ID', 'A test description', 'Test Name')

This is almost correct, except that the single quotes that Liquibase added around the "next value for SEQ_ITEM_TYPE_ID" part cause HSQLDB to give the following error:
Code:
java.sql.SQLException: data exception: invalid character value for cast

If I remove the sinqle quotes and run that SQL manually, it works as expected.

So, my question is, how do I use the Liquibase loadData command pulling data from a CSV file while populating one of the columns from a sequence?

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.

Loading...