Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include dates for first/last events to repo from Github API in code metrics marts #2346

Merged
merged 12 commits into from
Nov 3, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ repos as (
select
project_id,
artifact_source as event_source,
MIN(created_at) as first_created_at_date,
MAX(updated_at) as last_updated_at_date,
MIN(first_commit_time) as first_commit_date,
MAX(last_commit_time) as last_commit_date,
COUNT(distinct artifact_id) as repository_count,
Expand Down Expand Up @@ -172,6 +174,8 @@ select
project_metadata.project_name,
project_metadata.display_name,
project_metadata.event_source,
code_metrics.first_created_at_date,
code_metrics.last_updated_at_date,
code_metrics.first_commit_date,
code_metrics.last_commit_date,
code_metrics.repository_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ with repo_artifact as (
license_spdx_id,
language,
watcher_count,
created_at,
updated_at,
CAST(id as STRING) as artifact_source_id,
LOWER(owner) as artifact_namespace,
LOWER(name) as artifact_name
Expand All @@ -29,7 +31,9 @@ repo_snapshot as (
is_fork,
fork_count,
star_count,
watcher_count
watcher_count,
created_at,
updated_at
from repo_artifact as a
),

Expand Down Expand Up @@ -75,6 +79,8 @@ select distinct
repo_snapshot.watcher_count,
repo_snapshot.language,
repo_snapshot.license_spdx_id,
repo_snapshot.created_at,
repo_snapshot.updated_at,
repo_stats.first_commit_time,
repo_stats.last_commit_time,
repo_stats.days_with_commits_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ select
display_name,
event_source,
repository_count,
first_created_at_date,
last_updated_at_date,
first_commit_date,
last_commit_date,
star_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ with ranked_repositories as (
license_name,
license_spdx_id,
language,
created_at,
updated_at,
ingestion_time,
ROW_NUMBER()
over (partition by node_id order by ingestion_time desc, id asc)
Expand All @@ -39,6 +41,8 @@ select
license_name,
license_spdx_id,
language,
created_at,
updated_at,
ingestion_time
from ranked_repositories
where row_num = 1
18 changes: 18 additions & 0 deletions warehouse/dbt/models/staging/oss-directory/stg_ossd__schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,21 @@ models:
- &is_fork
name: is_fork
description: "is this repo a fork?"
- &license_name
name: license_name
description: "license name"
- &license_spdx_id
name: license_spdx_id
description: "license spdx id"
- &language
name: language
description: "programming language used in the repository"
- &created_at
name: created_at
description: "repository creation timestamp"
- &updated_at
name: updated_at
description: "repository last update timestamp"
- &ingestion_time
name: ingestion_time
description: "timestamp when the data was ingested"