Skip to content

Commit

Permalink
fix(glam): add a more robust way to fetch glean tables (mozilla#5787)
Browse files Browse the repository at this point in the history
* fix(glam): add a more robust way to fetch glean tables

* Add jq to image

* Remove useless space
  • Loading branch information
edugfilho authored Jun 14, 2024
1 parent 0447025 commit e71fa15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ FROM google/cloud-sdk:${GOOGLE_CLOUD_SDK_VERSION}-alpine AS google-cloud-sdk

FROM base
# add bash for entrypoint
RUN mkdir -p /usr/share/man/man1 && apt-get update -qqy && apt-get install -qqy bash git
RUN mkdir -p /usr/share/man/man1 && apt-get update -qqy && apt-get install -qqy bash git jq
COPY --from=google-cloud-sdk /google-cloud-sdk /google-cloud-sdk
ENV PATH /google-cloud-sdk/bin:$PATH
COPY --from=python-deps /usr/local /usr/local
Expand Down
13 changes: 6 additions & 7 deletions script/glam/generate_glean_sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ function write_clients_daily_aggregates {
# GLAM only supports tables with glean_ping_* schema.
# Also excluding use_counters because they are not supported
# and their generated query is too big to run
tables=$(
bq ls "$qualified" \
| grep TABLE \
| grep 'schema_id:glean_ping_[0-9]\+' \
| grep -v use_counters \
| awk '{print $1}'
)
tables=$(bq ls --format=json "$qualified" | \
jq -r '.[] |
select(.labels.schema_id | test("^glean_ping_[0-9]+")) |
select(.type == "TABLE") |
select(.tableReference.tableId | test("^use_counters.*") | not) |
"\(.tableReference.tableId)"')
# generate all of the schemas in parallel
for table in $tables; do
write_scalars "$product" "$dataset" "$table" "$dst_project" "$sql_dir" &
Expand Down

0 comments on commit e71fa15

Please sign in to comment.