A Python toolkit for Dimensional Modeling (Kimball methodology) using SQLModel.
Project description
sqldim
sqldim is a high-performance Python toolkit for Unified Dimensional & Graph Modeling. Built on top of SQLModel, it allows you to define complex Kimball-native structures that power both BI star schemas and network relationship traversals in a single, consistent model.
Core Pillars
- 🚀 Vectorized ETL: Powered by Narwhals. Handles millions of rows with single-pass joins using Polars, Pandas, or DuckDB backends.
- 🔄 Automated SCD: Built-in support for Type 1, 2, 3, and 6. Vectorized change detection eliminates row-by-row Python loops.
- 🕸️ Dual-Paradigm Graph: Project your dimensions as Vertices and facts as Edges. Traverse networks using Recursive CTEs without leaving your SQL database.
- ⏳ Semantic Time-Travel: Fluent query builder with automatic
AS OFjoin resolution for point-in-time analysis. - 🧊 Open Table Ready: Natively compatible with Apache Iceberg and Delta Lake via PyArrow/Narwhals integration.
Key Features
- Hybrid SCD: Combine typed columns with versioned JSONB property bags for flexible, heterogeneous metadata.
- Cumulative History: Replicate the "Array-of-Structs" pattern for dense longitudinal data (e.g., player seasons).
- Bitmask Activity: Ultra-low footprint user retention tracking (L7/L28 metrics) encoded in 32-bit integers.
- Topological Loading: Automatic dependency resolution ensures dimensions load before facts.
Quick Start
from sqldim import DimensionModel, SCD2Mixin, Field
class User(DimensionModel, SCD2Mixin, table=True):
__natural_key__ = ["email"]
email: str
plan_tier: str
# Loading is vectorized automatically if you pass a DataFrame
loader.register(User, source=polars_df)
await loader.run()
Documentation
See the /docs folder for detailed guides on:
Examples
Check out our real-world showcases:
examples/nba_analytics/: Longitudinal career analysis.examples/user_activity/: High-velocity retention tracking.examples/saas_growth/: Viral referral networks.
🌸 Built with love by SylphAI
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 sqldim-0.1.1.tar.gz.
File metadata
- Download URL: sqldim-0.1.1.tar.gz
- Upload date:
- Size: 58.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac2f17038f6ec9b4bf5500a81dc4af4a8b32aa07071946f12e386aba3841063
|
|
| MD5 |
1ead0d9ca44b9cc1f7532983cf307834
|
|
| BLAKE2b-256 |
cc019c9acf06074b6d024c7d6b1a4ea147a778f9f24bf3b38b2385600a5c6b6d
|
File details
Details for the file sqldim-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sqldim-0.1.1-py3-none-any.whl
- Upload date:
- Size: 55.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f91c93b4a05c3573ad7c2286014cd65f63b47bc845d0341e15d49c6b771d9b8
|
|
| MD5 |
9259166e2dee9e707ef37c880523611c
|
|
| BLAKE2b-256 |
0f4e39c07ef15a0cbe3cfca0454b136d1d94941cf9e29dd66e1a7304968445cf
|