I am writing a grails based application that implements the Liquibase functionality in a GUI based application. I am trying to use the CSV based data update funtionality. I have downloaded the latest version of 2.0 and when I make the update call it creates the update statement without any commas:
SQL INSERT INTO reference
.setting
(id version last_updated type create_user data_type value date_created update_user
) VALUES (‘1 1 TYPE admin BOOLEAN 20 admin’)
nknown column ‘id version last_updated type create_user data_type value date_created update_user’ in ‘field list’
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column ‘id version last_updated type create_user data_type value date_created update_user’ in ‘field list’
Is there some setting I am missing?
Scott Ryan
Was it the 2.0 RC1 version from the /download page, or the latest build from liquibase.org/ci/latest ?
Nathan
I am using a download from about a week ago. I tried to get the latest today but it just times out. Once I can get a current version I will try it as well and post here
Scott Ryan
Yes, the CI server appears to be down. I’m trying to find out from the admin what the state of it is.
If it’s a build from a week or so ago, it’s probably still a bug. I’ll see if I can replicate it.
Nathan
Once i get a new copy and will try to reproduce it. Once I can reproduce it I will send the code up to you so you can reproduce
Scott
I just built from the latest code base and still have the same issue. i am not sure what to send in as the context for the updata call so i just sent in an empty string. If I tried to us a null it throws a null pointer exception. The code is as follows:
String changeLogFile = FileUtilities.getDataChangeLogDirectory() + filename
Database database = DatabaseUtilities.getDatabase(databaseInfo)
def resourceAccessor = new FileSystemResourceAccessor()
Liquibase liquibase = new Liquibase(changeLogFile, resourceAccessor, database)
StringWriter writer = new StringWriter()
liquibase.update("")
The error is as follows:
Error 500: Executing action [updateData] of controller [com.dbmanager.controller.UpdateController] caused exception: liquibase.exception.MigrationFailedException: Migration failed for change set /Users/sc/SVN_WORKING//trunk/grails-app/domain/com/domain/changelog/data/sub/data.changelog-setting.xml::init-data-setting-1::scryan: Reason: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO `reference`.`setting` (`id version last_updated type create_user data_type value date_created update_user`) VALUES ('1 1 TYPE admin BOOLEAN 20 admin'): Caused By: Error executing SQL INSERT INTO `reference`.`setting` (`id version last_updated type create_user data_type value date_created update_user`) VALUES ('1 1 TYPE admin BOOLEAN 20 admin'): Caused By: Unknown column 'id version last_updated type create_user data_type value date_created update_user' in 'field list'
Servlet: grails
URI: /dbmanager/grails/update/updateData.dispatch
Exception Message: Unknown column 'id version last_updated type create_user data_type value date_created update_user' in 'field list'
Caused by: Unknown column 'id version last_updated type create_user data_type value date_created update_user' in 'field list'
Empty string works fine for the context. Null should too. I’ll look into why you’re getting no commas.
Nathan
Great I appreciate it. Please let me know if I can do anything to help debug
Scott
I found the issue.
The CSV file did not have all the required commas and the format of the import file did not honor the column labels. I had assumed that it would use the column names that i specified in my map but it is using all the columns. Once I reduced the columns down it loaded fine. I just need to figure out how to only use some of the columns in the spreadsheet. For example if I have 27 columns in the spreadsheet and only want to load 4,7,8,22 but want to identify them by header names rather than relative position.
Thanks for your help.
You should be able to specify them by header names. I opened a bug for it. http://liquibase.jira.com/browse/CORE-646
Nathan