Advertisement
roganhamby

Reingesting Records

Feb 21st, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create table rogan.alice as
  2. select id from biblio.record_entry where source = 102;
  3.  
  4. select count(id) from rogan.alice;
  5.  
  6. alter table rogan.alice add column ingested boolean default false;
  7.  
  8. -- now the batches
  9.  
  10. UPDATE config.internal_flag SET enabled = TRUE WHERE name = 'ingest.reingest.force_on_same_marc';
  11.  
  12. UPDATE biblio.record_entry SET id = id WHERE id in (select id from rogan.alice where ingested = FALSE order by id limit 500);
  13.  
  14. update rogan.alice set ingested = TRUE where id in (select id from rogan.alice where ingested = false order by id limit 500);
  15.  
  16. UPDATE config.internal_flag SET enabled = FALSE WHERE name = 'ingest.reingest.force_on_same_marc';
  17.  
  18. -- stuff to reingest records from wiki
  19.  
  20. -- update flag to force reingesting the record even if the MARC hasn't changed
  21. UPDATE config.internal_flag SET enabled = TRUE WHERE name = 'ingest.reingest.force_on_same_marc';
  22. UPDATE biblio.record_entry SET id = id WHERE id = 123;
  23. UPDATE config.internal_flag SET enabled = FALSE WHERE name = 'ingest.reingest.force_on_same_marc';
  24.  
  25. -- The same spell can be used to reingest an authority record:
  26. UPDATE config.internal_flag SET enabled = TRUE WHERE name = 'ingest.reingest.force_on_same_marc';
  27. UPDATE authority.record_entry SET id = id WHERE id = 123;
  28. UPDATE config.internal_flag SET enabled = FALSE WHERE name = 'ingest.reingest.force_on_same_marc';
  29.  
  30. -- here are several other flags that can be tweaked to selectively control which index tables get updated. These include:
  31.  
  32. ingest.metarecord_mapping.skip_on_update (enabling this can significantly speed up the reingest of a large number of records)
  33. ingest.disable_located_uri
  34. ingest.disable_metabib_full_rec
  35. ingest.disable_metabib_rec_descriptor
  36. ingest.disable_metabib_field_entry
  37.  
  38. -- Some flags apply when inserting new bibs:
  39.  
  40. ingest.metarecord_mapping.skip_on_insert (enabling this can significantly speed up importing a large number of bibs; use the spell for creating metarecords after loading the bibs)
  41. ingest.assume_inserts_only
  42. Other flags apply when dealing with authority records or changes to authorities:
  43.  
  44. ingest.disable_authority_linking
  45. ingest.disable_authority_auto_update
  46.  
  47. -- Dyrcona's
  48. -- A simple SQL to "reingest" your bib records in Evergreen.
  49. -- Feel free to use it however you like, though the easiest way is to
  50. -- save it into a file and do psql -f filename.
  51. DO $$
  52. DECLARE
  53.    flag BOOLEAN;
  54. BEGIN
  55.  
  56. SELECT enabled INTO flag
  57. FROM config.internal_flag
  58. WHERE name = 'ingest.reingest.force_on_same_marc';
  59.  
  60. IF flag IS FALSE THEN
  61.    UPDATE config.internal_flag
  62.    SET enabled = TRUE
  63.    WHERE name = 'ingest.reingest.force_on_same_marc';
  64. END IF;
  65.  
  66. UPDATE biblio.record_entry
  67. SET marc = marc
  68. WHERE id > 0;
  69.  
  70. IF flag IS FALSE THEN
  71.    UPDATE config.internal_flag
  72.    SET enabled = flag
  73.    WHERE name = 'ingest.reingest.force_on_same_marc';
  74. END IF;
  75.  
  76. END$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement