[Koha] bulkmarcimport-problems!

Eric Bégin Eric.Begin at inLibro.com
Tue Mar 13 04:20:36 NZDT 2012


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 at kohatest:~$ export PERL5LIB=/usr/share/koha/lib/
> koha at kohatest:~$ export KOHA_CONF=/etc/koha/koha-conf.xml
> koha at kohatest:~$
> koha at kohatest:~$ cd /usr/share/koha/bin/migration_tools
> koha at 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 at phonecoop.coop>
> To: koha at lists.katipo.co.nz
> Sent: Wednesday, 22 February, 2012 8:14:48 PM
> Subject: Re: [Koha] bulkmarcimport-problems!
>
> Magdalena Söderqvist<soderqvist at sipri.org>
>> koha at 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,


More information about the Koha mailing list