[OPEN-ILS-GENERAL] Batch deleting records
Josh Stompro
stomproj at exchange.larl.org
Thu Jun 16 17:04:46 EDT 2016
While we are on this subject. What is the proper way to delete items, then volumes/call number, bibs via sql? I’m looking at deleting ~3000 withdrawn copies after we grab the ones that are last copies to tell OCLC about. I would rather not use the staff client since it seems to have problems with that many records at once.
Is it as simple as:
1. Marking all the copies deleted (Update asset.copy set deleted=true where status=withdrawn_code)
2. Updating all asset.call_number entries to deleted=true that have no non-deleted copies.
3. Updating all biblio.record_entries that have no call_numbers.
Is there a db function for this that I can call directly? I’ve done a little bit of searching but I haven’t come up with anything yet. Blake mentions deleting the bibs at the end of his message, so I’m hopeful it is that easy. I think the delete just gets re-written as an update. Any help would be appreciated.
Thanks
Josh Stompro - LARL IT Director
From: Open-ils-general [mailto:open-ils-general-bounces at list.georgialibraries.org] On Behalf Of Chris Owens
Sent: Thursday, June 16, 2016 2:52 PM
To: open-ils-general at list.georgialibraries.org
Subject: Re: [OPEN-ILS-GENERAL] Batch deleting records
Thank you all for your advice and words of caution. I would say this is yet another reason to prefer the old-fashioned book, but I wouldn't want to sound like a luddite.
We will tread lightly.
Chris
Chris Owens
Director
Blanchester Public Library
110 N. Broadway
Blanchester, OH 45107
937-783-3585
937-783-2910 (fax)
cowens at blanlibrary.org<mailto:cowens at blanlibrary.org>
On 6/16/2016 11:47 AM, Blake Henderson wrote:
Chris,
You will need to get a list of record ID's. Record buckets use record ID's.
The easiest way to do that would be a SQL query.
Something like this:
select distinct record, isbn from
(
select record,regexp_replace(value,$$\D$$,$$$$,$$g$$) \"isbn\",value from metabib.real_full_rec where
record in
(
select record from asset.call_number where
not deleted and
label=$$##URI##$$
)
)
and
tag=$$020$$
and
record not in(select id from biblio.record_entry where deleted)
) as a
where length(isbn) in(10,13)
and
isbn in
( COMMA SEPARATED ISBN LIST )
order by 1;
The above query has a section "COMMA SEPARATED ISBN LIST" where you will have to fill in your list like this:
'4412349854',
'2390340943',
'2390340943345',
....
....
This will return record id's that have scoped 856 URLs. If your records do not have scoped 856's, then you will need to remove this section of the query:
record in
(
select record from asset.call_number where
not deleted and
label=$$##URI##$$
)
)
and
Once you have your record ID's, then you may as well delete them in SQL (make sure the list looks correct)
Delete query:
delete from biblio.record_entry where id in( LIST OF IDS );
-Blake-
Conducting Magic
MOBIUS
573-234-4513
877-312-3517
On 6/16/2016 10:17 AM, Chris Owens wrote:
Is there an "easy" way to get a multiple records (50-75) into a record bucket from a list of ISBNs? We are going to have to start deleting eBook records from our system given a list of titles with ISBNs. And I am trying to avoid doing it record by record.
I appreciate any advice.
Thanks,
Chris
--
Chris Owens
Director
Blanchester Public Library
110 N. Broadway
Blanchester, OH 45107
937-783-3585
937-783-2910 (fax)
cowens at blanlibrary.org<mailto:cowens at blanlibrary.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-general/attachments/20160616/69469456/attachment-0001.html>
More information about the Open-ils-general
mailing list