Skip to content
Back to skills

Fabric Model

ASecurity

Build Gold layer analytical objects — dimensional models (Kimball star schema), KPI aggregates, wide tables, or TMDL semantic models. Use when creating fact tables, dimension tables, monthly aggregates, or Power BI semantic models from Silver data. Enforces referential integrity, metric standardization, and schema locking.

  • 33 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
businesspythongosql

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add scardoso-lu/fabric-skills-settings --skill fabric-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fabric Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fabric Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/scardoso-lu-fabric-model/badge)](https://www.skillsdirectory.com/skills/scardoso-lu-fabric-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: fabric-model
description: Build Gold layer analytical objects — dimensional models (Kimball star schema), KPI aggregates, wide tables, or TMDL semantic models. Use when creating fact tables, dimension tables, monthly aggregates, or Power BI semantic models from Silver data. Enforces referential integrity, metric standardization, and schema locking.
---

# fabric-model

## MUST

- Define business metrics in Gold — never in the BI tool or downstream
- Verify dimension key existence before writing fact rows (referential integrity gate)
- Link orphan facts to the `-1` / `Unknown` dimension key — never drop fact rows
- Run `OPTIMIZE` with `ZORDER` after every Gold write
- Gold schemas are a contract — schema changes require explicit approval and backfill plan

## PREFER

- Kimball star schema (fact + dimension tables) for standard reporting
- One atomic fact table at lowest grain + aggregate tables for KPIs
- Delta Lake tables over views for materialized Gold
- Separate lakehouse for Gold layer (independent access control)
- `DELETE + INSERT` over MERGE in Fabric Warehouse (MERGE is preview)

## AVOID

- Business logic (churn definition, LTV formula) in Power BI DAX — define it in Gold
- Dropping fact rows when dimension is missing — use Unknown dimension key
- Plain APPEND on Gold tables (creates duplicates on re-run)
- Overloading fact tables with descriptive attributes (put them in dimensions)

## Dimensional Model Pattern

```python
# Dimension table (slowly changing, type 1 overwrite)
dim_customers = silver_customers.select(
    F.col("customer_id"),
    F.col("customer_name"),
    F.col("region"),
    F.col("segment"),
    F.current_timestamp().alias("_dim_updated_at"),
).dropDuplicates(["customer_id"])

(dim_customers.write
    .format("delta")
    .mode("overwrite")
    .option("overwriteSchema", "false")  # schema is locked
    .save(dim_path)
)

# Fact table with RI gate
unknown_customer_id = -1

fact_orders = (silver_orders
    .join(dim_customers.select("customer_id"), on="customer_id", how="left")
    .withColumn("customer_key",
        F.when(F.col("customer_id").isNotNull(), F.col("customer_id"))
         .otherwise(F.lit(unknown_customer_id))
    )
)

(fact_orders
    .write.format("delta")
    .mode("overwrite")
    .partitionBy("order_month")
    .save(fact_path)
)
```

## Gold Optimization (always run after write)

```python
spark.conf.set("spark.sql.parquet.vorder.enabled", "true")
spark.conf.set("spark.microsoft.delta.optimizeWrite.enabled", "true")
spark.sql(f"OPTIMIZE delta.`{fact_path}` ZORDER BY (order_date, region_id)")
```

## KPI Aggregate Pattern

```python
kpi_monthly = (fact_orders
    .groupBy(
        F.date_format("order_date", "yyyy-MM").alias("month"),
        F.col("region_id")
    )
    .agg(
        F.sum("revenue").alias("total_revenue"),
        F.countDistinct("customer_id").alias("active_customers"),
        F.count("order_id").alias("order_count"),
    )
)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.