bulkmarcimport-problems!
Hi all, my IT-expert is helping me import some marc-records which I have edited in Marc Edit. But importing the records back into Koha is not working. And the editing itself does not seem to be the problem, we get the same error message when trying to import the orginal, unedited .mrc file, which I pulled from the "tools/export.pl" page. Do the below messages contain enough information to tell what we're doing wrong? Any help is, as always, much appreciated. We are currently running version 3.6.2 on Debian Squeeze. Also: we're doing this on a copy of the database, could that be part of the problem? Cheers, Magdalena ******************** deleting biblios
DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96.
******************* Duplicate entry 'A13150' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 361, <GEN16> line 804. .DBD::mysql::st execute failed: Duplicate entry 'A13151' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> line 805. ERROR in _koha_new_item INSERT INTO items SET ******************** - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Magdalena Söderqvist Librarian SIPRI Library and Documentation Department STOCKHOLM INTERNATIONAL PEACE RESEARCH INSTITUTE Signalistgatan 9 SE-169 70 Solna, Sweden Telephone: +46 8 655 97 78 Fax: +46 8 655 97 33 Email: soderqvist@sipri.org Internet: www.sipri.org
Tjänare, Magdalena! 2012/2/17 Magdalena Söderqvist <soderqvist@sipri.org>:
Hi all, my IT-expert is helping me import some marc-records which I have edited in Marc Edit. But importing the records back into Koha is not working. And the editing itself does not seem to be the problem, we get the same error message when trying to import the orginal, unedited .mrc file, which I pulled from the "tools/export.pl" page. Do the below messages contain enough information to tell what we're doing wrong? Any help is, as always, much appreciated. We are currently running version 3.6.2 on Debian Squeeze.
Also: we're doing this on a copy of the database, could that be part of the problem?
That should not be a problem, it's a really, really good idea! ;-)
******************** deleting biblios
DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96.
*******************
Not sure about this first part.
Duplicate entry 'A13150' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 361, <GEN16> line 804. .DBD::mysql::st execute failed: Duplicate entry 'A13151' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> line 805. ERROR in _koha_new_item INSERT INTO items SET
From the subject I guess you are re-importing with the bulkmarcimport.pl command line script. How are you running that? With what options?
The default is that Koha will add your records as if they were new, which causes the error above, because the barcodes that you try to import are already present in the database. I *think* this should be taken care of if you run the script with "-match 999c" - this should match on the biblionumber in field 999$c. I have not tested that though... Best regards, Magnus Enger libriotech.no
Hej Magnus - and thanks for the quick response! The suggestion to run "-match 999c" - did not work though! I'm attaching error messages from both import attempts. Does anyone have any suggestion on where we might go from here?? //Magdalena Latest attempt (with -match 999c): koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match 999c -commit 1000 -v -v -file /root/40_77000_2.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. .Use of uninitialized value $recorddata in pattern match (m//) at ./bulkmarcimport.pl line 392, <GEN16> line 1. unable to search the database for duplicates : No query entered at ./bulkmarcimport.pl line 217, <GEN16> line 1. First import attempt (without -match 999c ) koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -commit 1000 -v -file /root/40_77000_2.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. .DBD::mysql::st execute failed: Duplicate entry 'A27112' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> line 1. ERROR in _koha_new_item INSERT INTO items SET biblionumber = ?, biblioitemnumber = ?, barcode = ?, ----- Original Message ----- From: "Magnus Enger" <magnus@enger.priv.no> To: "Magdalena Söderqvist" <soderqvist@sipri.org> Cc: koha@lists.katipo.co.nz Sent: Friday, 17 February, 2012 1:01:44 PM Subject: Re: [Koha] bulkmarcimport-problems! Tjänare, Magdalena! 2012/2/17 Magdalena Söderqvist <soderqvist@sipri.org>:
Hi all, my IT-expert is helping me import some marc-records which I have edited in Marc Edit. But importing the records back into Koha is not working. And the editing itself does not seem to be the problem, we get the same error message when trying to import the original, unedited .mrc file, which I pulled from the "tools/export.pl" page. Do the below messages contain enough information to tell what we're doing wrong? Any help is, as always, much appreciated. We are currently running version 3.6.2 on Debian Squeeze.
Also: we're doing this on a copy of the database, could that be part of the problem?
That should not be a problem, it's a really, really good idea! ;-)
******************** deleting biblios
DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96.
*******************
Not sure about this first part.
Duplicate entry 'A13150' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 361, <GEN16> line 804. .DBD::mysql::st execute failed: Duplicate entry 'A13151' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105, <GEN16> line 805. ERROR in _koha_new_item INSERT INTO items SET
From the subject I guess you are re-importing with the bulkmarcimport.pl command line script. How are you running that? With what options?
The default is that Koha will add your records as if they were new, which causes the error above, because the barcodes that you try to import are already present in the database. I *think* this should be taken care of if you run the script with "-match 999c" - this should match on the biblionumber in field 999$c. I have not tested that though... Best regards, Magnus Enger libriotech.no -- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Magdalena Söderqvist Librarian SIPRI Library and Documentation Department STOCKHOLM INTERNATIONAL PEACE RESEARCH INSTITUTE Signalistgatan 9 SE-169 70 Solna, Sweden Telephone: +46 8 655 97 78 Fax: +46 8 655 97 33 Email: soderqvist@sipri.org Internet: www.sipri.org
Magdalena Söderqvist <soderqvist@sipri.org>
koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match 999c -commit 1000 -v -v -file /root/40_77000_2.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96.
Well, -d deletes the old biblios before importing the file, but the database is refusing because some of them have issued items.
.Use of uninitialized value $recorddata in pattern match (m//) at ./bulkmarcimport.pl line 392, <GEN16> line 1. unable to search the database for duplicates : No query entered at ./bulkmarcimport.pl line 217, <GEN16> line 1.
I got similar errors when trying to use -match earlier today. I thought it was just my mistake, but maybe it's not. Does anyone have an insight into this? I think I'll next get chance to investigate it next Wednesday, which is quite a wait. Hope that informs, -- MJ Ray (slef), member of www.software.coop, a for-more-than-profit co-op. http://koha-community.org supporter, web and library systems developer. In My Opinion Only: see http://mjr.towers.org.uk/email.html Available for hire (including development) at http://www.software.coop/
Hi again! Just an update for future reference regarding our problems with bulkmarc import. MJ Ray kindly suggested us to try the following: "I now think the parameter to -match needs an index name in front of it, with a comma. It then tries to match the tag against it. So http://manual.koha-community.org/3.6/en/kohasearchindexes.html makes me think you actually want -match barcode,999c" Sadly, it did not make any difference, same long error message. See beginning of the message below. (Testdatabase version still 3.6.2 on Debian squeeze). Possible bug?? -------------------------------------------------------------------------- As the koha user: koha@kohatest:~$ export PERL5LIB=/usr/share/koha/lib/ koha@kohatest:~$ export KOHA_CONF=/etc/koha/koha-conf.xml koha@kohatest:~$ koha@kohatest:~$ cd /usr/share/koha/bin/migration_tools koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match=barcode,999c -commit 1000 -v -file /tmp/newer40_77000.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. .DBD::mysql::st execute failed: Duplicate entry 'A27112' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105. ERROR in _koha_new_item INSERT INTO items SET -------------------------------------------------------------------------- I also tried out the "Stage marc records for import" under "Tools" to see if that might be a way, but while it was swiftly done to upload the file , when it was asked to "Stage" the records (matched on 952$p) it quickly jumped to 1% and then nothing happened for 20 minutes. And when trying to abort I got a software error message, see below - luckily still on a test database. Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/koha/lib/C4/Context.pm line 693. Compilation failed in require at /usr/share/koha/lib/C4/Auth.pm line 33. BEGIN failed--compilation aborted at /usr/share/koha/lib/C4/Auth.pm line 33. Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. I think we're going to have to pay someone to take closer look at this - Magnus, beware :) Cheers, //Magdalena ----- Original Message ----- From: "MJ Ray" <mjr@phonecoop.coop> To: koha@lists.katipo.co.nz Sent: Wednesday, 22 February, 2012 8:14:48 PM Subject: Re: [Koha] bulkmarcimport-problems! Magdalena Söderqvist <soderqvist@sipri.org>
koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match 999c -commit 1000 -v -v -file /root/40_77000_2.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96.
Well, -d deletes the old biblios before importing the file, but the database is refusing because some of them have issued items.
.Use of uninitialized value $recorddata in pattern match (m//) at ./bulkmarcimport.pl line 392, <GEN16> line 1. unable to search the database for duplicates : No query entered at ./bulkmarcimport.pl line 217, <GEN16> line 1.
I got similar errors when trying to use -match earlier today. I thought it was just my mistake, but maybe it's not. Does anyone have an insight into this? I think I'll next get chance to investigate it next Wednesday, which is quite a wait. Hope that informs, -- MJ Ray (slef), member of www.software.coop, a for-more-than-profit co-op. http://koha-community.org supporter, web and library systems developer. In My Opinion Only: see http://mjr.towers.org.uk/email.html Available for hire (including development) at http://www.software.coop/ _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz http://lists.katipo.co.nz/mailman/listinfo/koha -- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Magdalena Söderqvist Librarian SIPRI Library and Documentation Department STOCKHOLM INTERNATIONAL PEACE RESEARCH INSTITUTE Signalistgatan 9 SE-169 70 Solna, Sweden Telephone: +46 8 655 97 78 Fax: +46 8 655 97 33 Email: soderqvist@sipri.org Internet: www.sipri.org
Magdalena, The log indicates some problems with the foreign key constraints. Since you are deleting your existing records before importing the new one (-d options), you must also specify the -fk (disabling foreign key check). So running the following command should work : ./bulkmarcimport.pl -d -fk -match=barcode,999c -commit 1000 -v -file /tmp/newer40_77000.mrc Hope that helps, Eric Bégin www.inLibro.com On 2012-03-12 11:05, Magdalena Söderqvist wrote:
Hi again!
Just an update for future reference regarding our problems with bulkmarc import. MJ Ray kindly suggested us to try the following:
"I now think the parameter to -match needs an index name in front of it, with a comma. It then tries to match the tag against it. So http://manual.koha-community.org/3.6/en/kohasearchindexes.html makes me think you actually want -match barcode,999c"
Sadly, it did not make any difference, same long error message. See beginning of the message below. (Testdatabase version still 3.6.2 on Debian squeeze). Possible bug?? -------------------------------------------------------------------------- As the koha user:
koha@kohatest:~$ export PERL5LIB=/usr/share/koha/lib/ koha@kohatest:~$ export KOHA_CONF=/etc/koha/koha-conf.xml koha@kohatest:~$ koha@kohatest:~$ cd /usr/share/koha/bin/migration_tools koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match=barcode,999c -commit 1000 -v -file /tmp/newer40_77000.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 97. DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 98. .DBD::mysql::st execute failed: Duplicate entry 'A27112' for key 'itembarcodeidx' at /usr/share/koha/lib/C4/Items.pm line 2105. ERROR in _koha_new_item INSERT INTO items SET
-------------------------------------------------------------------------- I also tried out the "Stage marc records for import" under "Tools" to see if that might be a way, but while it was swiftly done to upload the file , when it was asked to "Stage" the records (matched on 952$p) it quickly jumped to 1% and then nothing happened for 20 minutes. And when trying to abort I got a software error message, see below - luckily still on a test database.
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/koha/lib/C4/Context.pm line 693. Compilation failed in require at /usr/share/koha/lib/C4/Auth.pm line 33. BEGIN failed--compilation aborted at /usr/share/koha/lib/C4/Auth.pm line 33. Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. I think we're going to have to pay someone to take closer look at this - Magnus, beware :)
Cheers, //Magdalena
----- Original Message -----
From: "MJ Ray"<mjr@phonecoop.coop> To: koha@lists.katipo.co.nz Sent: Wednesday, 22 February, 2012 8:14:48 PM Subject: Re: [Koha] bulkmarcimport-problems!
Magdalena Söderqvist<soderqvist@sipri.org>
koha@kohatest:/usr/share/koha/bin/migration_tools$ perl ./bulkmarcimport.pl -d -match 999c -commit 1000 -v -v -file /root/40_77000_2.mrc deleting biblios DBD::mysql: b do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at ./bulkmarcimport.pl line 96. Well, -d deletes the old biblios before importing the file, but the database is refusing because some of them have issued items.
.Use of uninitialized value $recorddata in pattern match (m//) at ./bulkmarcimport.pl line 392,<GEN16> line 1. unable to search the database for duplicates : No query entered at ./bulkmarcimport.pl line 217,<GEN16> line 1. I got similar errors when trying to use -match earlier today. I thought it was just my mistake, but maybe it's not. Does anyone have an insight into this? I think I'll next get chance to investigate it next Wednesday, which is quite a wait.
Hope that informs,
participants (4)
-
Eric Bégin -
Magdalena Söderqvist -
Magnus Enger -
MJ Ray