Skip to main content

Logo

Fabric Spark - dbt

dbt adapter for Fabric Spark supporting SQL models.

dbt Docs · Fabric Lakehouse with Spark · Fabric Lakehouse Livy API

Tests and Code Checks Release to PyPI
Python dbt-core License


dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.

dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis.

dbt-fabricspark

The dbt-fabricspark package contains all of the code enabling dbt to work with Apache Spark in Microsoft Fabric. This adapter connects to Fabric Lakehouses via Livy endpoints and supports both schema-enabled and non-schema Lakehouse configurations.

Key Features

  • Livy session management with session reuse and robust connectivity across dbt runs
  • Lakehouse with schema support — auto-detects schema-enabled lakehouses and uses three-part naming (lakehouse.schema.table)
  • Lakehouse without schema — standard two-part naming (lakehouse.table)
  • Materializations: table, view, incremental (append, merge, insert_overwrite, microbatch, delete+insert), seed, snapshot
  • Fabric Environment support via environmentId configuration
  • Security: credential masking, UUID validation, HTTPS + domain validation, thread-safe token refresh
  • Resilience: HTTP 5xx retry with exponential backoff, bounded polling with configurable timeouts

Getting started

To contribute to this adapter codebase, see CONTRIBUTING.md.

Installation

pip install dbt-fabricspark

For local development using Azure CLI authentication (authentication: CLI), install with the cli extra:

pip install dbt-fabricspark[cli]

For an in-process Spark Session, install PySpark with the spark extra:

pip install "dbt-fabricspark[spark]"

PySpark remains optional: omit this extra when using Livy, or when the runtime already provides PySpark, such as a Fabric Spark notebook. The session method supports PySpark 3.5 and 4.x.

Note: The azure-cli optional dependency is only required for the CLI authentication mode. Service Principal (SPN) and Fabric Notebook (fabric_notebook) authentication modes do not need it.

Configuration

Add a target to profiles.yml. This example connects to a schema-enabled Lakehouse through Fabric Livy with Azure CLI authentication:

fabric-spark-test:
  target: fabricspark-dev
  outputs:
    fabricspark-dev:
        type: fabricspark
        method: livy
        endpoint: https://api.fabric.microsoft.com/v1
        workspaceid: <your-workspace-id>
        lakehouseid: <your-lakehouse-id>
        lakehouse: my_lakehouse
        schema: dbo
        authentication: CLI
        threads: 4
        spark_config:
          name: my-dbt-session

See Lakehouses for how lakehouse and schema select two- or three-part naming, and the Configuration Reference for every option.

Documentation

Guide Covers
Connections Livy and in-process Spark Session connections, authentication modes and spark_config
Lakehouses Lakehouses with and without schemas, schema detection, cross-lakehouse writes and case-sensitive identifiers
Cross-Workspace 4-Part Naming Reading from and writing to lakehouses in other workspaces
Configuration Reference Every profiles.yml option
Incremental strategies Incremental strategies, advanced merge options and on_schema_change
Automatic OPTIMIZE Compacting Delta tables after each build, and turning it off
Transient operation retry Retrying Spark SQL statements and MLV refreshes that fail with a matching error
High-concurrency Livy Per-thread REPLs, session reuse and the spark.highConcurrency.max cap
Shortcuts Creating and pruning OneLake shortcuts from a JSON definition
Publish descriptions to the Lakehouse Table overview Writing dbt descriptions to OneLake table metadata with persist_docs_onelake
Materialized Lake Views The materialized_lake_view materialization, constraints and refresh schedules
FAQs Frequently asked questions
Continuous integration How CI authenticates to Fabric through the IMDS relay bridge

Issues, bug-bashing, help us help you

⚠️ Here's how you can get your issue triaged and fixed ASAP

In the age of AI, we should be innovating and shipping high-quality software daily.

So in this adapter, we try to fix bugs and ship features fast - and keep an extremely high bar for test coverage in CI before PRs merge to main.

Once you open an issue, please - try to be as descriptive as possible to give our human/AI maintainers the necessary details to reproduce the issue rapidly.

For example - if you can - create a dummy repro dbt project in your GitHub account - so the maintainers can reproduce your problem ASAP - see an example a well-written GitHub issue here.

If the issue is complex - once we have a fix identified, to gain more confidence, we might ask you install the adapter right from a PR branch to ensure the repro is gone in your setup as well, like so:

pip install git+https://github.com/microsoft/dbt-fabricspark.git@dev/somebranch/123

Reporting bugs and contributing code

Join the dbt Community

Code of Conduct

Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the dbt Code of Conduct.

Metadata

Release files for dbt-fabricspark 1.13.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbt-fabricspark 1.13.14
File Size Uploaded Provenance Actions
dbt_fabricspark-1.13.14.tar.gz 553.1 kB Without provenance Details for dbt_fabricspark-1.13.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbt-fabricspark 1.13.14
File Interpreter ABI Platform Actions
dbt_fabricspark-1.13.14-py3-none-any.whl Python 3 none any Details for dbt_fabricspark-1.13.14-py3-none-any.whl

Total release size: 684.6 kB

Release files / dbt_fabricspark-1.13.14.tar.gz

Download URL dbt_fabricspark-1.13.14.tar.gz
Size 553.1 kB
Tags Source
SHA-256 checksum
How to use checksums
099ce10fc3c05337235dd353894e4e82f084c21ef1fd48356245f7d01eb88dae
BLAKE2b-256 checksum
How to use checksums
12592e2149352fef7962ddeaeacad5f9c3c895420d600a9e6c36283d8e11f5b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dbt_fabricspark-1.13.14-py3-none-any.whl

Download URL dbt_fabricspark-1.13.14-py3-none-any.whl
Size 131.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b82e57659248a3e6e35160a319c4d7a31ffa8169fa27dda4feca4631c61515c
BLAKE2b-256 checksum
How to use checksums
10d50021c0d13ffb14a0a4074d9842a7979afa9292ec798ceb27ebbd94a218bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dbt-fabricspark 1.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.13.14 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page