[Evergreen-dev] Pulling audit_user for a change from auditor table
Chris Sharp
csharp at georgialibraries.org
Tue Sep 21 09:50:03 EDT 2021
Josh,
I would avoid using the auditor tables for this if possible. I've always
seen those as an internal means of accountability. They aren't exposed by
the fieldmapper and so aren't available to end users at this point at all,
which I think is mostly a good thing.
However, answering your question at face value, as I understand it, since
the auditor tables record the ID (or other primary key) of the source
table, I usually search by (say) biblio.record_entry.id, then sort by
audit_id or audit_date. We have some scripts we use for PINES staff to
search the audit tables here for reference:
https://git.evergreen-ils.org/?p=contrib/pines.git;a=tree;f=pines-finder;h=408f6d1ccfba2188e2c2446b911f56150c5fc6b9;hb=HEAD
Hope that's helpful!
Chris
On Tue, Sep 21, 2021 at 12:06 AM Josh Stompro via Evergreen-dev <
evergreen-dev at list.evergreen-ils.org> wrote:
> Hello, I'm stuck on how to grab the user that made a change from an
> auditor table? How do I look for the first occurrence of a new value, and
> then grab the previous rows audit_user and audit_date?
>
> The way that I understand it, the auditor tables store the user that made
> a change, and then the old values that were in the audited table before the
> change. So the audit_user and audit_date are not for the data in the same
> row, but are for the next newest row.
>
> Do I need a window function so I can look at previous rows? Or is there a
> much simpler way to do it? Maybe a window with lag()/lead() to shift the
> audit_user and audit_date to the next row?
>
> I'm working on seeing if I can pull out barcode creation info, to fill in
> actor.card creator and create_date for LP#1705332, which adds those fields
> into actor.card.
>
> Thanks for any hints.
> Josh
> [image: Company logo]
> *Josh Stompro*
>
> *IT Director stomproj at gsuite.larl.org <stomproj at gsuite.larl.org>*
> *218-233-3757 ext. 139* | *Mobile: 218-790-2110*
>
> *Lake Agassiz Regional Library | **www.larl.org <http://www.larl.org>*
> 118 5th ST S
> Moorhead MN 56560
> *Celebrating 60 Years of Service in 2021!*
> _______________________________________________
> Evergreen-dev mailing list
> Evergreen-dev at list.evergreen-ils.org
> http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-dev
>
--
Chris Sharp, PINES System Administrator
------------------------------
Georgia Public Library Service
2872 Woodcock Blvd, Suite 250 | Atlanta, GA 30341
(404) 235-7147 | csharp at georgialibraries.org
<https://www.facebook.com/georgialibraries>
<https://www.twitter.com/georgialibs>
<https://www.instagram.com/georgialibraries/>
Join our email list <http://georgialibraries.org/subscription> for stories
of Georgia libraries making an impact in our communities.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-dev/attachments/20210921/48e54b6b/attachment-0001.html>
More information about the Evergreen-dev
mailing list