This repository was archived by the owner on Oct 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- DELIMITER $$
2-
31/*
4- */
5- DROP PROCEDURE IF EXISTS iterate_ingest_range$$
6- CREATE PROCEDURE iterate_ingest_range(dstart date , dend date )
7- BEGIN
8- if dend > dstart then
9- set @dcur = dstart;
10- loop_label: LOOP
11- set @dnext = adddate(@dcur, interval 1 day);
12-
13- call update_ingests_processed_for_day(@dcur);
14-
15- set @dcur = @dnext;
16- if @dcur >= dend then
17- LEAVE loop_label;
18- end if;
19- END LOOP;
20- end if;
21- END$$
22-
23- DELIMITER ;
24-
25- DELIMITER $$
26-
27- DROP PROCEDURE IF EXISTS update_ingests_processed$$
28- CREATE PROCEDURE update_ingests_processed()
29- BEGIN
30- call iterate_ingest_range(
31- (
32- select
33- date_add(max (ingest_date), INTERVAL 1 DAY)
34- from
35- ingests_completed
36- ),
37- date (now())
38- );
39- END$$
40-
41- DELIMITER ;
42-
43- DELIMITER $$
44-
45- DROP PROCEDURE IF EXISTS update_ingests_processed_for_day$$
46- CREATE PROCEDURE update_ingests_processed_for_day(dcur date )
47- BEGIN
48- set @dcur = dcur;
49- delete from
50- ingests_completed
51- where
52- ingest_date = @dcur;
53-
54- insert into
55- ingests_completed
56- select
57- date (max (submitted)) as ingest_date,
58- profile,
59- batch_id,
60- count (* )
61- from
62- inv .inv_ingests
63- where
64- date (submitted) = @dcur
65- group by
66- profile,
67- batch_id
68- order by
69- date (max (submitted)) desc
70- ;
71-
72- END$$
73-
74- DELIMITER ;
2+ See https://github.com/CDLUC3/merritt-docker/blob/main/mrt-services/mysql/init.sql for stored procedure definitions
3+ */
You can’t perform that action at this time.
0 commit comments