Support Restatements on SCD Type 2 and Use Them When Creating Preview Clone

Đang mở
#5,901 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python

Hướng nghiên cứu

Start by reading the SCD Type 2 implementation and the preview-clone flow; the issue does not name specific files or tests. Understand how inserts currently handle historical intervals, then determine how restating from a chosen date should affect both existing rows and preview clones. Done means the requested restatement behavior works and is covered by tests, including the preview-clone use case.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature Improvement

Currently SCD Type 2 supports only restating the model from the beginning of time. One could also restate a model at any point in history too but also end with the latest date. This how how it would work:

Lets say I am restating Jan 10th

Delete from the table where all valid_from >= Jan 10th
Update the table where all valid_to >= Jan 10th
This would reset the table to look like it was last run before the given start date.

Ideally, once this is implemented, when we create a preview clone of a model we would then configure the clone to restate this latest model with the new logic.

Suggestion for resolving that is to update the SCD Type 2 logic to always go through this delete/update logic on each insert. That way in most cases where we are just processing the newest interval it would be no-op (does require a scan though) and when we have to restate it would delete/update as expected.

Inherited from #3642

Ngôn ngữ chính
Python
Star
3.3k
Fork
471
Merge trung bình
6 ngày 7 giờ
Pull request đã merge (30 ngày)
35

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của SQLMesh/sqlmesh

Tất cả issue của SQLMesh/sqlmesh

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.