Skip to content

feat: silver_events 증분 모델 (GA4 이벤트 정제)#20

Merged
RimSM merged 1 commit into
mainfrom
feat/silver-events-incremental
Jul 14, 2026
Merged

feat: silver_events 증분 모델 (GA4 이벤트 정제)#20
RimSM merged 1 commit into
mainfrom
feat/silver-events-incremental

Conversation

@RimSM

@RimSM RimSM commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

GA4 이벤트를 정제하는 첫 silver 모델. silver_ga4_eventssilver_events 리네임.

  • 증분: insert_overwrite + event_dt 파티션 + user_pseudo_id/event_name 클러스터
  • GA4 late data 대응: 매 실행 최근 3일 재처리
  • 날짜 파라미터: --vars '{"start_date":"YYYYMMDD","end_date":"YYYYMMDD"}' (백필/특정범위) → Airflow가 이 vars 주입 예정
  • flatten: event_params(배열)/device(레코드) → 컬럼 (이벤트/세션/기기/파라미터)
  • 테스트: not_null (event_dt, event_name, user_pseudo_id)

검증 (로컬 stage)

  • 전체: 64.4만행 / 252 MiB
  • 날짜범위(7/115): 확정분 7/113만 처리 확인 (intraday 제외)

참고

기존 Dataform incremental_stg_events_final 스키마 참고해서 GA4 부분만 추출.
user 속성(gender/major/uid_norm)은 후속 silver_users에서 (앱 DB 적재 후 조인).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an incremental silver_events dataset for GA4 event data.
    • Supports processing recent events or backfilling a specified date range.
    • Expanded event, session, device, page, and engagement fields.
    • Added data-quality checks for required dates, event names, and user identifiers.
  • Refactor
    • Replaced the previous current-day GA4 events model with the new incremental event dataset.
  • Documentation
    • Clarified partitioning, incremental processing, and backfill behavior.

- silver_ga4_events → silver_events 리네임 (dataset=silver라 ga4 접두어 제거)
- incremental + insert_overwrite + event_dt 파티션
- GA4 최근 3일 재처리 (late data) + 백필용 날짜 vars(start_date/end_date)
- event_params/device 를 컬럼으로 flatten (이벤트/세션/기기/파라미터)
- not_null 테스트 (event_dt, event_name, user_pseudo_id)

로컬 stage 검증: 전체(64.4만행) + 날짜범위(7/1~15) 실행 확인.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@RimSM
RimSM merged commit 11e6372 into main Jul 14, 2026
@RimSM
RimSM deleted the feat/silver-events-incremental branch July 14, 2026 22:59
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83cb416e-958a-4474-a3c6-aad9501c58e2

📥 Commits

Reviewing files that changed from the base of the PR and between 4133e3f and cd559e3.

📒 Files selected for processing (4)
  • dbt/models/silver/_ga4__sources.yml
  • dbt/models/silver/_silver__models.yml
  • dbt/models/silver/silver_events.sql
  • dbt/models/silver/silver_ga4_events.sql

📝 Walkthrough

Walkthrough

The PR replaces the current-day GA4 silver model with an incremental silver_events model, adds configurable date filtering and event attributes, updates its schema contract, and removes the previous model implementation.

Changes

GA4 silver events model

Layer / File(s) Summary
Model contract and source configuration
dbt/models/silver/_ga4__sources.yml, dbt/models/silver/_silver__models.yml
The source mapping is reformatted, and silver_ga4_events is replaced by an expanded silver_events schema with additional fields and nullability tests.
Incremental date selection
dbt/models/silver/silver_events.sql
The model uses insert_overwrite with date partitioning, supports start_date and end_date, excludes intraday tables, and defaults incremental runs to the latest three days.
Event transformation and output
dbt/models/silver/silver_events.sql
GA4 events are standardized into typed timestamps, session and device fields, and pivoted event parameters before the transformed rows are returned.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant dbt as dbt silver_events
  participant ga4 as ga4.events
  participant table as silver_events table
  dbt->>ga4: Select non-intraday events for the selected date range
  ga4-->>dbt: Return GA4 event rows
  dbt->>dbt: Standardize fields and pivot event parameters
  dbt->>table: Insert-overwrite event_dt partitions
Loading

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/silver-events-incremental

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant