]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0608.data.vandelay-export-error-match-info.sql
Break up expensive queries, match index to quals
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0608.data.vandelay-export-error-match-info.sql
1 -- Evergreen DB patch 0608.data.vandelay-export-error-match-info.sql
2 --
3 --
4 BEGIN;
5
6
7 -- check whether patch can be applied
8 SELECT evergreen.upgrade_deps_block_check('0608', :eg_version);
9
10 -- Add vqbr.import_error, vqbr.error_detail, and vqbr.matches.size to queue print output
11
12 UPDATE action_trigger.event_definition SET template = $$
13 [%- USE date -%]
14 <pre>
15 Queue ID: [% target.0.queue.id %]
16 Queue Name: [% target.0.queue.name %]
17 Queue Type: [% target.0.queue.queue_type %]
18 Complete? [% target.0.queue.complete %]
19
20     [% FOR vqbr IN target %]
21 =-=-=
22  Title of work    | [% helpers.get_queued_bib_attr('title',vqbr.attributes) %]
23  Author of work   | [% helpers.get_queued_bib_attr('author',vqbr.attributes) %]
24  Language of work | [% helpers.get_queued_bib_attr('language',vqbr.attributes) %]
25  Pagination       | [% helpers.get_queued_bib_attr('pagination',vqbr.attributes) %]
26  ISBN             | [% helpers.get_queued_bib_attr('isbn',vqbr.attributes) %]
27  ISSN             | [% helpers.get_queued_bib_attr('issn',vqbr.attributes) %]
28  Price            | [% helpers.get_queued_bib_attr('price',vqbr.attributes) %]
29  Accession Number | [% helpers.get_queued_bib_attr('rec_identifier',vqbr.attributes) %]
30  TCN Value        | [% helpers.get_queued_bib_attr('eg_tcn',vqbr.attributes) %]
31  TCN Source       | [% helpers.get_queued_bib_attr('eg_tcn_source',vqbr.attributes) %]
32  Internal ID      | [% helpers.get_queued_bib_attr('eg_identifier',vqbr.attributes) %]
33  Publisher        | [% helpers.get_queued_bib_attr('publisher',vqbr.attributes) %]
34  Publication Date | [% helpers.get_queued_bib_attr('pubdate',vqbr.attributes) %]
35  Edition          | [% helpers.get_queued_bib_attr('edition',vqbr.attributes) %]
36  Item Barcode     | [% helpers.get_queued_bib_attr('item_barcode',vqbr.attributes) %]
37  Import Error     | [% vqbr.import_error %]
38  Error Detail     | [% vqbr.error_detail %]
39  Match Count      | [% vqbr.matches.size %]
40
41     [% END %]
42 </pre>
43 $$
44 WHERE id = 39;
45
46
47 -- Do the same for the CVS version
48
49 UPDATE action_trigger.event_definition SET template = $$
50 [%- USE date -%]
51 "Title of work","Author of work","Language of work","Pagination","ISBN","ISSN","Price","Accession Number","TCN Value","TCN Source","Internal ID","Publisher","Publication Date","Edition","Item Barcode","Import Error","Error Detail","Match Count"
52 [% FOR vqbr IN target %]"[% helpers.get_queued_bib_attr('title',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('author',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('language',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('pagination',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('isbn',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('issn',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('price',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('rec_identifier',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('eg_tcn',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('eg_tcn_source',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('eg_identifier',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('publisher',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('pubdate',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('edition',vqbr.attributes) | replace('"', '""') %]","[% helpers.get_queued_bib_attr('item_barcode',vqbr.attributes) | replace('"', '""') %]","[% vqbr.import_error | replace('"', '""') %]","[% vqbr.error_detail | replace('"', '""') %]","[% vqbr.matches.size %]"
53 [% END %]
54 $$
55 WHERE id = 40;
56
57 -- Add matches to the env for both
58 INSERT INTO action_trigger.environment (event_def, path) VALUES (39, 'matches');
59 INSERT INTO action_trigger.environment (event_def, path) VALUES (40, 'matches');
60
61 COMMIT;
62