PySpark library for Slowly Changing Dimension Type 2 (SCD2) transformations
Project description
loadx
A PySpark library for Slowly Changing Dimension Type 2 (SCD2) transformations.
Tracks historical changes to dimensional data using valid/until date ranges, hash-based change detection, and active/delete flags.
Installation
pip install loadx
Quick start
from loadx import SCD2Loader
result_df = SCD2Loader.slowly_changing_dimension(
source_df=df,
business_keys=["employee_id"],
snapshot_date="2024-01-01",
)
Incremental load
result_df = SCD2Loader.slowly_changing_dimension(
source_df=new_df,
business_keys=["employee_id"],
snapshot_date="2024-02-01",
target_df=existing_df, # merge with existing history
ignore_columns=["updated_at"], # exclude from change detection
)
Output columns
| Column | Description |
|---|---|
valid_from |
Date the record became active |
valid_until |
Date the record was superseded (9999-12-31 = currently active) |
active_flag |
True for the current version of a record |
delete_flag |
True for records deleted from the source |
latest_record_flag |
True for the most recent record per key |
upsert_flag |
I (insert) or U (update) for downstream merge operations |
Documentation
Full documentation at kamathramu87.github.io/loadx.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loadx-0.1.1.tar.gz.
File metadata
- Download URL: loadx-0.1.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ce018aabfc793dc47a6a532fbbab39d7968f7fd449380b53b304cf4522073b
|
|
| MD5 |
671748e27201089d35d7fc2c110f4b13
|
|
| BLAKE2b-256 |
b5784bd004d7a665463104661e7b0293b6f3024aabb2b1b12ed9836da3cefabd
|
Provenance
The following attestation bundles were made for loadx-0.1.1.tar.gz:
Publisher:
publish.yml on kamathramu87/loadx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loadx-0.1.1.tar.gz -
Subject digest:
44ce018aabfc793dc47a6a532fbbab39d7968f7fd449380b53b304cf4522073b - Sigstore transparency entry: 1207577896
- Sigstore integration time:
-
Permalink:
kamathramu87/loadx@772f4c4083aaa837ca14b68eec07dd32163a49d1 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/kamathramu87
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@772f4c4083aaa837ca14b68eec07dd32163a49d1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file loadx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: loadx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1859c913821732b2e068dae813f9b36a88c90b4fe3a97ed7060f19c4a9520e41
|
|
| MD5 |
704c89fd712ad9081c0625727fb459ec
|
|
| BLAKE2b-256 |
c25e152b30a08a4dd445e0b84a2a9f9811ce26510272cbd4914d5f61fddcc066
|
Provenance
The following attestation bundles were made for loadx-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on kamathramu87/loadx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loadx-0.1.1-py3-none-any.whl -
Subject digest:
1859c913821732b2e068dae813f9b36a88c90b4fe3a97ed7060f19c4a9520e41 - Sigstore transparency entry: 1207577955
- Sigstore integration time:
-
Permalink:
kamathramu87/loadx@772f4c4083aaa837ca14b68eec07dd32163a49d1 -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/kamathramu87
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@772f4c4083aaa837ca14b68eec07dd32163a49d1 -
Trigger Event:
release
-
Statement type: