aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dump_reingest.sql
blob: 5ec288307ae5f8db0c9fd9776e98bddfa2fbb486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'spn2-%'
        AND ingest_file_result.status != 'spn2-error:invalid-url-syntax'
        AND ingest_file_result.status != 'spn2-error:spn2-error:filesize-limit'
) TO '/grande/snapshots/reingest_weekly_spn2-error_current.rows.json';

COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'cdx-error'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
        AND (ingest_request.ingest_request_source = 'fatcat-changelog'
             OR ingest_request.ingest_request_source = 'fatcat-ingest')
) TO '/grande/snapshots/reingest_weekly_cdx-error_current.rows.json';

COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'cdx-error'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
        AND (ingest_request.ingest_request_source != 'fatcat-changelog'
             AND ingest_request.ingest_request_source != 'fatcat-ingest')
) TO '/grande/snapshots/reingest_weekly_cdx-error_bulk_current.rows.json';

COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'wayback-error'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
) TO '/grande/snapshots/reingest_weekly_wayback-error_current.rows.json';

COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'gateway-timeout'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
        AND (ingest_request.ingest_request_source = 'fatcat-changelog'
             OR ingest_request.ingest_request_source = 'fatcat-ingest')
) TO '/grande/snapshots/reingest_weekly_gateway-timeout.rows.json';

COPY (
    SELECT row_to_json(ingest_request.*) FROM ingest_request
    LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
    WHERE ingest_request.ingest_type = 'pdf'
        AND ingest_file_result.ingest_type = 'pdf'
        AND ingest_file_result.hit = false
        AND ingest_file_result.status like 'petabox-error'
        AND ingest_request.created < NOW() - '6 hour'::INTERVAL
        AND ingest_request.created > NOW() - '8 day'::INTERVAL
        AND (ingest_request.ingest_request_source = 'fatcat-changelog'
             OR ingest_request.ingest_request_source = 'fatcat-ingest')
) TO '/grande/snapshots/reingest_weekly_petabox-error_current.rows.json';