Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #132 from bcc-code/update-changes
Browse files Browse the repository at this point in the history
Unpack commits from metadata in changes.sql
  • Loading branch information
dinagraves authored Jun 2, 2021
2 parents 2ab2eee + dddb5aa commit 015ed3b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions queries/changes.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changes Table
SELECT
source,
id as change_id,
time_created,
event_type
FROM four_keys.events_raw
event_type,
JSON_EXTRACT_SCALAR(commit, '$.id') change_id,
TIMESTAMP_TRUNC(TIMESTAMP(JSON_EXTRACT_SCALAR(commit, '$.timestamp')),second) as time_created,
FROM four_keys.events_raw e,
UNNEST(JSON_EXTRACT_ARRAY(e.metadata, '$.commits')) as commit
WHERE event_type in ("pull_request", "push", "merge_request")
GROUP BY 1,2,3,4;
GROUP BY 1,2,3,4

0 comments on commit 015ed3b

Please sign in to comment.