Skip to main content

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 OF join 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqldim-0.1.0.tar.gz (58.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqldim-0.1.0-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file sqldim-0.1.0.tar.gz.

File metadata

  • Download URL: sqldim-0.1.0.tar.gz
  • Upload date:
  • Size: 58.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for sqldim-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8828eace52ba1de3bd7ccd7176d650849c0549ee07f31f269a5550df61718e0
MD5 d4f4a911988a8170d7b42f2e1e946cb3
BLAKE2b-256 ecdf05060a4d7e824607490024a7bc47c8a0ed02262846f3d9d1eeadfed5b9c7

See more details on using hashes here.

File details

Details for the file sqldim-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqldim-0.1.0-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

Hashes for sqldim-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 185afc3a977b2308423d7bbcac4622de5e6196f68b2f191e87914b886ce71ae6
MD5 ae19f166e9b5f92568b760ce4ab8b9dd
BLAKE2b-256 33de6d77d6bac26fe764b72b7d6d77b6ba46974dbb39b77d456c3db23a5616bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page