From 63ae50bd222fe36b338c00e9ab9a3549a7554db0 Mon Sep 17 00:00:00 2001 From: Carl Cervone <42869436+ccerv1@users.noreply.github.com> Date: Sat, 14 Dec 2024 21:48:00 -0500 Subject: [PATCH] feat(dbt): repos mart model (#2645) * feat(dbt): int_repositories * feat(dbt): repositories mart model --- .../directory/int_repositories.sql | 20 ++++++++++++++ .../marts/directory/repositories_v0.sql | 27 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 warehouse/dbt/models/intermediate/directory/int_repositories.sql create mode 100644 warehouse/dbt/models/marts/directory/repositories_v0.sql diff --git a/warehouse/dbt/models/intermediate/directory/int_repositories.sql b/warehouse/dbt/models/intermediate/directory/int_repositories.sql new file mode 100644 index 000000000..d70ea8585 --- /dev/null +++ b/warehouse/dbt/models/intermediate/directory/int_repositories.sql @@ -0,0 +1,20 @@ +select + artifacts.project_id, + artifacts.artifact_source_id, + artifacts.artifact_source, + artifacts.artifact_namespace, + artifacts.artifact_name, + artifacts.artifact_url, + repos.is_fork, + repos.branch, + repos.star_count, + repos.watcher_count, + repos.fork_count, + repos.license_name, + repos.license_spdx_id, + repos.language, + repos.created_at, + repos.updated_at +from {{ ref('int_artifacts_in_ossd_by_project') }} as artifacts +inner join {{ ref('stg_ossd__current_repositories') }} as repos + on artifacts.artifact_source_id = CAST(repos.id as STRING) diff --git a/warehouse/dbt/models/marts/directory/repositories_v0.sql b/warehouse/dbt/models/marts/directory/repositories_v0.sql new file mode 100644 index 000000000..00f4f139a --- /dev/null +++ b/warehouse/dbt/models/marts/directory/repositories_v0.sql @@ -0,0 +1,27 @@ +{{ + config( + materialized='table', + meta = { + 'sync_to_db': True, + } + ) +}} + +select + project_id, + artifact_source_id, + artifact_source, + artifact_namespace, + artifact_name, + artifact_url, + is_fork, + branch, + star_count, + watcher_count, + fork_count, + license_name, + license_spdx_id, + `language`, + created_at, + updated_at +from {{ ref('int_repositories') }}