Download presentation
Presentation is loading. Please wait.
Published byHomer Roland Webster Modified over 9 years ago
1
Using SQL for Patron Card Expiration Reminders For Norcal IUG – Nov. 20, 2015 At the Berkeley Public Library
2
MARINet is… A consortium of 7 public and 2 academic libraries in Marin County. 152k patrons 531k bibs 1.2m items 3 Fulltime ILS staff +
3
Roles! Sys Admin, System Librarian, Office Manager
4
“SQL” means Structured Query Language SELECT * from table where table.column = ‘stuff’ It has it’s own syntax, etc.
5
Familiar?
6
In this context… “SQL” means getting data out of Sierra Using software Using a Sierra Login (application SQL) Open port 1032 to db server if needed
7
Expiring cards… In July, 2014, 42% of our public library cards were expired. (We delete inactive cards after 3 years.) In Sept. 2014 we started sending out “Your card expires next month” emails to public library patrons. Now, 34% of our public library are expired. (9% absolute drop, or a decrease of 19%!)
8
Renewing cards… The number of cards which expire in any given month seems to have gone down (since the emails) by 10 to 15%.
9
Why it matters… People travelling are caught out by card expiration. Encore does not list card expiration on patron account page. Ebook/Eaudiobook users don’t tend to interact with their library records and with staff in the traditional ways.
10
SQL can… Find the expiring (public) library cards (filter for patron type and home library) for “next month” Find the ones with email addresses (85.5%) Retrieve: – Home library – Expiration date – Email – Barcode (last 5 digits)
11
The software to start with… http://www.pgadmin.org/download/windows.php
12
PG Admin III – Database Window
13
PG Admin III – Query Window
14
Where to find query samples…
15
SQL Query Samples
16
Code sample
17
Or from the listservs… IUG listserv Sierra listserv
18
I keep my queries in old text files…
19
Full of old text…
20
PG Admin: Results in a text file
21
Seeing the DB past the SDA
22
To see the structure of the DB
23
Running SQL queries with scripting can do much more… Scripting can retrieve the data using SQL queries and store it in text files, even manipulate the data and query again Scripting can generate an email for each patron using the SQL data Scripting can email the data (if pointed at an email server) Scripting can be scheduled…
24
People are using… Mostly PHP Some Perl Some Python Languages that don’t start with “P”?
25
MARINet: Perl Old, old, old programming language What we used to use for Expect scripts Fairly easy to write and maintain, “just like English” Caveat: SQL connector for Perl requires a Linux box (old PC, free software)
26
Modify the date… Modify the date first Supplying range of dates for SQL query
27
Then run the thing… “perl expcards.pl”
28
5 minutes Search 152,000 records, find 3,000 Search again for address, then for phone numbers (display data for patron update) Sends the emails out Runs Command line (we have not scheduled it)
29
It came from the library… The patron’s home library determines “reply to” address
30
Sample email
31
Get the script? http://lists.marinet.info/expcards
32
Nothing to fear…
33
Other things we use SQL for: Quick queries where it works better than Create Lists (Link+, How many items, ) Link+ overdues Link+ daily hold and checkout counts (emailed) Find empty volume records Find orphaned items (volume records)
34
…and… Find old frozen holds (and email the patrons that we’re going to delete them) Bibs with holds webpage (2x daily) Data upload to Ebsco for NoveList Looking for more uses
35
The End – Questions? Dan McMahon dmcmahon@marinet.info
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.