Skip to content
Open
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
6 changes: 3 additions & 3 deletions dataform.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"defaultSchema": "dataform_stackoverflow",
"defaultSchema": "dataform_stackoverflow_vikram",
"assertionSchema": "dataform_stackoverflow_assertions",
"warehouse": "bigquery",
"defaultDatabase": "dataform-dogfood-shared",
"defaultLocation": "US"
"defaultDatabase": "cloud-dataform-testing",
"defaultLocation": "europe-west3"
}
24 changes: 24 additions & 0 deletions definitions/reporting/user_stats1.sqlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
config {type: 'table'}

select
stg_users.user_id,
stg_users.age,
${common.ageBucket("stg_users.age")} as age_bucket,
stg_users.creation_date,
stg_users.user_tenure,
count(distinct stg_badges.badge_id) as badge_count,
count(distinct posts_all.post_id) as questions_and_answer_count,
count(distinct if(type="question", posts_all.post_id, null)) as question_count,
count(distinct if(type="answer", posts_all.post_id, null)) as answer_count,
max(stg_badges.award_timestamp) as last_badge_received_at,
max(posts_all.created_at) as last_posted_at,
max(if(type="question", posts_all.created_at, null)) as last_question_posted_at,
max(if(type="answer", posts_all.created_at, null)) as last_answer_posted_at
from
${ref("stg_users")} as stg_users
left join ${ref("stg_badges")} as stg_badges
on stg_users.user_id = stg_badges.user_id
left join ${ref("posts_combined")} as posts_all
on stg_users.user_id = posts_all.owner_user_id
group by
1,2,3,4,5
1 change: 0 additions & 1 deletion definitions/staging/stg_badges.sqlx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
config {
type: "view",
schema: "staging",
description: "Cleaned version of stackoverflow.badges"
}

Expand Down
1 change: 0 additions & 1 deletion definitions/staging/stg_posts_answers.sqlx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
config {
type: "view",
schema: "staging",
description: "Cleaned version of stackoverflow.posts_answers"
}

Expand Down
1 change: 0 additions & 1 deletion definitions/staging/stg_posts_questions.sqlx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
config {
type: "view",
schema: "staging",
description: "Cleaned version of stackoverflow.posts_questions"
}

Expand Down
1 change: 0 additions & 1 deletion definitions/staging/stg_users.sqlx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
config {
type: "view",
schema: "staging",
description: "Cleaned version of stackoverflow.users table"
}

Expand Down