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

Fix dbt and IMDb models #72

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions models/duckdb/stg_imdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ base as (
extracted_at :: timestamp as extracted_at,
title,
first_value(title) over (partition by movie_id order by extracted_at :: timestamp) as title_first,
rank,
rank :: int as rank,
case
when rating_20230119_2215 is not null then rating_20230119_2215
else split_part(rating, chr(160), 1) :: double
end as rating,
rating_count,
year,
rating_count :: int as rating_count,
year :: int as year,
link
from source

Expand Down
1 change: 1 addition & 0 deletions models/postgres/admin/fct_dbt_invocations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from {{ ref('stg_dbt_invocations') }}
1 change: 1 addition & 0 deletions models/postgres/admin/fct_dbt_model_executions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from {{ ref('stg_dbt_model_executions') }}
7 changes: 7 additions & 0 deletions models/postgres/staging/dbt/_dbt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sources:
- name: raw_dbt

tables:
- name: invocations
- name: model_executions

31 changes: 31 additions & 0 deletions models/postgres/staging/dbt/stg_dbt_invocations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
with source as (
select * from {{ source('raw_dbt', 'invocations') }}
),

base as (

select
command_invocation_id,
dbt_version,
project_name,
run_started_at,
dbt_command,
full_refresh_flag,
target_profile_name,
target_name,
target_schema,
target_threads,
dbt_cloud_project_id,
dbt_cloud_job_id,
dbt_cloud_run_id,
dbt_cloud_run_reason_category,
dbt_cloud_run_reason,
env_vars,
dbt_vars,
invocation_args,
dbt_custom_envs
from source

)

select * from base
29 changes: 29 additions & 0 deletions models/postgres/staging/dbt/stg_dbt_model_executions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
with source as (
select * from {{ source('raw_dbt', 'model_executions') }}
),

base as (

select
command_invocation_id || node_id as model_execution_id,
command_invocation_id,
node_id,
run_started_at,
was_full_refresh,
split_part(thread_id, '-', 2) as thread_id,
status,
compile_started_at,
query_completed_at,
total_node_runtime,
rows_affected
as materialization,
schema
as name,
alias,
message,
adapter_response
from source

)

select * from base
Loading