[Koha] SQL queries to delete records from the database?

Sonia P. sossolapro at hotmail.com
Mon Jul 23 15:57:46 NZST 2012




So something like that?





mysqldump -u kohauser -p kohalibrary  > savedatabase230712.sql


mysql -u username -p[password]use kohalibrary;DELETE FROM biblio WHERE biblionumber='2315';
(never done mysql things in commandline before...)
Cheers,
Sonia.








> Date: Mon, 23 Jul 2012 15:42:59 +1200
> From: chrisc at catalyst.net.nz
> To: sossolapro at hotmail.com
> CC: koha at lists.katipo.co.nz
> Subject: Re: [Koha] SQL queries to delete records from the database?
> 
> * Sonia P. (sossolapro at hotmail.com) wrote:
> > 
> > Hello
> > 
> > It seems that we can't use 'delete' commands in the Koha admin website (build SQL reports or so).  How can I do that?
> > I need to delete these records, I know the proper command, I just want to be allowed to do it.
> > 
> Yes, that is because its a hugely dangerous thing to allow someone to
> type a delete into the web interface. Imagine, delete from issues;
> 
> For doing these kind of operations, you should do it in the mysql
> prompt on the commandline. After backing up the database of course.
> 
> Chris
> 
> > (I am now down to 20 faulty records, so I will just delete them from the database one by one, I know they are only present in the 'biblio' table)
> > 
> > Cheers,
> > 
> > Sonia.
> > 
> > 
> > > From: sossolapro at hotmail.com
> > > To: koha at lists.katipo.co.nz
> > > Date: Sun, 22 Jul 2012 00:00:42 +0200
> > > Subject: [Koha] SQL queries to delete records from the database?
> > > 
> > > 
> > > Hi there
> > > 
> > > (re:  rebuild-zebra stops working very often, which is not a proper title any more... :p)
> > > 
> > > I tried to edit a few records from these non-indexed records.  As we speak another language, we have accent issues.  So I need to make sure (again) that our librarians doesn't use any accent on the letters.  So all the records which I have found from that list of non-indexed records have accent problems.  
> > > 
> > > On some records, I can edit the content and remove the accents.
> > > 
> > > 
> > > But for some records, I can't even edit the content, because then there 
> > > is an error with Koha, the page doesn't show anything with something 
> > > like that:  << Software error: Can't call method "field" on an 
> > > undefined value at /usr/share/koha/lib/C4/Items.pm line 1421.>> 
> > > which is just a random error because it can't find the record anymore 
> > > (it finds the records on certain pages, for instance if I want to see 
> > > its history, but it can't find the record on any page where it should 
> > > show its title).  So no way to solve the problem using the Koha 
> > > interface...
> > > 
> > > 
> > >  I guess I need a sql query to delete these records from the 
> > > database, but something that would really delete everything related to 
> > > that item (history, etc). Do you have any idea about that?
> > > 
> > > 
> > > But then I just don't understand why these problem records prevent zebra from reindexing the newly entered records... :/
> > > 
> > > Anyway, I have done the koha-rebuild-zebra -v -f library command to reindex everything. 
> > > See below the new report from that new perl script, we moved from 138 non-indexed records to 56 non-indexed records,  just because I have modified a few records (5?) and because I have rerun rebuild-zebra (so it indexed the newly entered records which had no accent problems anyway).
> > > 
> > > Many thanks for your help!
> > > Would greatly appreciate your expertise about SQL queries to delete everything for faulty records.
> > > 
> > > Sonia.
> > > 
> > > ############
> > > 
> > > 1000 done
> > > 2000 done
> > > biblionumber 2315 not indexed
> > > 3000 done
> > > 4000 done
> > > biblionumber 5230 not indexed
> > > biblionumber 5234 not indexed
> > > 5000 done
> > > 6000 done
> > > 7000 done
> > > 8000 done
> > > 9000 done
> > > 10000 done
> > > 11000 done
> > > 12000 done
> > > 13000 done
> > > 14000 done
> > > 15000 done
> > > 16000 done
> > > 17000 done
> > > biblionumber 19992 not indexed
> > > biblionumber 20030 not indexed
> > > 18000 done
> > > biblionumber 20177 not indexed
> > > biblionumber 20234 not indexed
> > > biblionumber 20316 not indexed
> > > biblionumber 20317 not indexed
> > > biblionumber 20397 not indexed
> > > biblionumber 20398 not indexed
> > > biblionumber 20399 not indexed
> > > biblionumber 20400 not indexed
> > > biblionumber 20418 not indexed
> > > biblionumber 20446 not indexed
> > > biblionumber 20448 not indexed
> > > biblionumber 20491 not indexed
> > > biblionumber 20494 not indexed
> > > biblionumber 20495 not indexed
> > > biblionumber 20499 not indexed
> > > biblionumber 20500 not indexed
> > > biblionumber 20501 not indexed
> > > biblionumber 20502 not indexed
> > > biblionumber 20505 not indexed
> > > biblionumber 20590 not indexed
> > > biblionumber 20614 not indexed
> > > biblionumber 20615 not indexed
> > > biblionumber 20616 not indexed
> > > biblionumber 20617 not indexed
> > > biblionumber 20618 not indexed
> > > biblionumber 20626 not indexed
> > > biblionumber 20627 not indexed
> > > biblionumber 20628 not indexed
> > > biblionumber 20648 not indexed
> > > biblionumber 20677 not indexed
> > > biblionumber 20686 not indexed
> > > biblionumber 20849 not indexed
> > > biblionumber 20917 not indexed
> > > biblionumber 20921 not indexed
> > > biblionumber 21016 not indexed
> > > biblionumber 21039 not indexed
> > > biblionumber 21045 not indexed
> > > biblionumber 21097 not indexed
> > > biblionumber 21138 not indexed
> > > biblionumber 21141 not indexed
> > > biblionumber 21142 not indexed
> > > biblionumber 21145 not indexed
> > > 19000 done
> > > biblionumber 21810 not indexed
> > > biblionumber 21811 not indexed
> > > 20000 done
> > > biblionumber 22320 not indexed
> > > biblionumber 22338 not indexed
> > > biblionumber 22386 not indexed
> > > biblionumber 22583 not indexed
> > > 21000 done
> > > biblionumber 23506 not indexed
> > > biblionumber 23507 not indexed
> > > biblionumber 23508 not indexed
> > > 22000 done
> > > 23000 done
> > > 24000 done
> > > 25000 done
> > > 26000 done
> > > 27000 done
> > > 28000 done
> > > 29000 done
> > > 30000 done
> > > 31000 done
> > > 32000 done
> > > 56 bibliorecords not indexed
> > >  		 	   		  
> > > _______________________________________________
> > > Koha mailing list  http://koha-community.org
> > > Koha at lists.katipo.co.nz
> > > http://lists.katipo.co.nz/mailman/listinfo/koha
> >  		 	   		  
> > _______________________________________________
> > Koha mailing list  http://koha-community.org
> > Koha at lists.katipo.co.nz
> > http://lists.katipo.co.nz/mailman/listinfo/koha
> 
> -- 
> Chris Cormack
> Catalyst IT Ltd.
> +64 4 803 2238
> PO Box 11-053, Manners St, Wellington 6142, New Zealand
 		 	   		  


More information about the Koha mailing list