Error using Csvimport - database issue?

Just upgraded to Omeka 1.4.2 and Csvimport 1.3.3 was installed. (I've successfully used Csvimport before the upgrade - we were at Omeka 1.2.x).

I upload the file, select the mapping columns and boom... I enabled error logging as requested and the result stack trace is below. I ran the test twice - same error.

2011-12-30T15:44:42-08:00 ERR (3): exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 'original_filename' in 'field list'' in /home/maynardhistory/collection/application/libraries/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/maynardhistory/collection/application/libraries/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('?        INSERT...')
#1 /home/maynardhistory/collection/application/libraries/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), '?        INSERT...')
#2 /home/maynardhistory/collection/application/libraries/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('?        INSERT...')
#3 [internal function]: Zend_Db_Adapter_Abstract->query('?        INSERT...', Array)
#4 /home/maynardhistory/collection/application/libraries/Omeka/Db.php(84): call_user_func_array(Array, Array)
#5 /home/maynardhistory/collection/application/libraries/Omeka/Db.php(298): Omeka_Db->__call('query', Array)
#6 /home/maynardhistory/collection/application/libraries/Omeka/Db.php(298): Omeka_Db->query('?        INSERT...', Array)
#7 /home/maynardhistory/collection/application/libraries/Omeka/Db.php(268): Omeka_Db->exec('?        INSERT...', Array)
#8 /home/maynardhistory/collection/application/libraries/Omeka/Record.php(553): Omeka_Db->insert('CsvImport_Impor...', Array)
#9 /home/maynardhistory/collection/application/libraries/Omeka/Record.php(583): Omeka_Record->save()
#10 /home/maynardhistory/collection/plugins/CsvImport/controllers/IndexController.php(121): Omeka_Record->forceSave()
#11 /home/maynardhistory/collection/application/libraries/Zend/Controller/Action.php(513): CsvImport_IndexController->mapColumnsAction()
#12 /home/maynardhistory/collection/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('mapColumnsActio...')
#13 /home/maynardhistory/collection/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#14 /home/maynardhistory/collection/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#15 /home/maynardhistory/collection/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#16 /home/maynardhistory/collection/application/libraries/Omeka/Core.php(166): Zend_Application->run()
#17 /home/maynardhistory/collection/admin/index.php(45): Omeka_Core->run()
#18 {main}

Since CSV Import doesn't save any really useful data, it's not a bad idea to try uninstalling and re-installing the plugin when you're experiencing issues.

As for diagnosing the problem, the little piece of the query I can see in your error logs:

'?           INSERT...'

doesn't look quite right. Try enabling SQL logging in your config file.

SQL logging will produce lots of output, but you're looking for an INSERT, and there should be only one if you just use CsvImport after enabling logging.

Hi John.

Thanks for looking at this for us. Here's the log (after a pile of SELECTS...):

2012-01-05T15:04:40-08:00 DEBUG (7):
        INSERT INTO <code>omeka_csv_import_imports</code> (
        <code>original_filename</code>, <code>file_path</code>, <code>file_position</code>, <code>item_type_id</code>, <code>collection_id</code>, <code>owner_id</code>, <code>added</code>, <code>delimiter</code>, <code>is_public</code>, <code>is_featured</code>, <code>skipped_row_count</code>, <code>skipped_item_count</code>, <code>status</code>, <code>serialized_column_maps</code>, <code>id</code>
        ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE <code>original_filename</code> = ?, <code>file_path</code> = ?, <code>file_position</code> = ?, <code>item_type_id</code> = ?, <code>collection_id</code> = ?, <code>owner_id</code> = ?, <code>added</code> = ?, <code>delimiter</code> = ?, <code>is_public</code> = ?, <code>is_featured</code> = ?, <code>skipped_row_count</code> = ?, <code>skipped_item_count</code> = ?, <code>status</code> = ?, <code>serialized_column_maps</code> = ?, <code>id</code> = LAST_INSERT_ID(<code>id</code>)
2012-01-05T15:04:40-08:00 ERR (3): exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 'original_filename' in 'field list'' in /home/maynardhistory/collection/application/libraries/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/maynardhistory/collection/application/libraries/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('?        INSERT...')
#1 /home/maynardhistory/collection/application/libraries/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), '?        INSERT...')
#2 /home/maynardhistory/collection/application/libraries/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('?        INSERT...')
#3 [internal function]: Zend_Db_Adapter_Abstract->query('?        INSERT...', Array)
...

Here's the schema.... Perhaps all I need to do is delete the plugin and re-add it? It may not have upgraded the table properly.

CREATE TABLEomeka_csv_import_imports` (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
item_type_id int(10) unsigned NOT NULL,
collection_id int(10) unsigned NOT NULL,
csv_file_name text COLLATE utf8_unicode_ci NOT NULL,
status varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
error_details text COLLATE utf8_unicode_ci,
item_count int(10) unsigned NOT NULL,
is_public tinyint(1) DEFAULT '0',
is_featured tinyint(1) DEFAULT '0',
stop_import_if_file_download_error tinyint(1) DEFAULT '0',
serialized_column_maps text COLLATE utf8_unicode_ci NOT NULL,
added timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
`

Yes, I'd try that.

It doesn't look like the plugin's table was upgraded correctly, but choosing "Uninstall" and then "Install" again on the plugin management page it should clear up this problem.

I wish I had thought of that in the first place.... Uninstalling and Reinstalling did the trick. Working perfectly (once again). Thank you!