go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cipd/appengine/push_bq_schema.sh (about)

     1  #!/bin/bash
     2  
     3  THIS_DIR=$(dirname "$0")
     4  
     5  read -p "Cloud Project name to push BQ schema to: " PROJECT_ID
     6  
     7  bqschemaupdater \
     8    -table "$PROJECT_ID.cipd.events" \
     9    -friendly-name "CIPD event log." \
    10    -message-dir "$THIS_DIR/../api/cipd/v1" \
    11    -message "cipd.Event" \
    12    -partitioning-field "when"
    13  
    14  bqschemaupdater \
    15    -table "$PROJECT_ID.cipd.access" \
    16    -friendly-name "CIPD access log." \
    17    -message-dir "$THIS_DIR/../api/cipd/v1" \
    18    -message "cipd.AccessLogEntry" \
    19    -partitioning-field "timestamp" \
    20    -partitioning-expiration "8760h"  # 1y
    21  
    22  bqschemaupdater \
    23    -table "$PROJECT_ID.cipd.verification" \
    24    -friendly-name "CIPD verification log." \
    25    -message-dir "$THIS_DIR/../api/cipd/v1" \
    26    -message "cipd.VerificationLogEntry" \
    27    -partitioning-field "submitted" \
    28    -partitioning-expiration "8760h"  # 1y
    29  
    30  # Note: this table is used as a template table to create 'exported_tags_<jobid>'
    31  # tables that contain tags exported by a single specific mapper job. Each such
    32  # individual table is an approximate "snapshot" of the state of tags at the time
    33  # the job ran.
    34  bqschemaupdater \
    35    -table "$PROJECT_ID.cipd.exported_tags" \
    36    -friendly-name "Tags exported via EXPORT_TAGS_TO_BQ mapper job." \
    37    -message-dir "$THIS_DIR/../api/cipd/v1" \
    38    -message "cipd.ExportedTag" \
    39    -disable-partitioning  # doesn't work with template tables