dbt-fabricspark is a Microsoft Fabric Spark adapter plugin for dbt (data build tool), enabling data analysts and engineers to transform data within Microsoft Fabric Lakehouses. It connects to Fabric Lakehouses via Livy endpoints, supports both schema-enabled and non-schema configurations, and includes Livy session management. The library is actively maintained by Microsoft and its current version is 1.9.5, typically aligning with dbt-core release cycles.
pip install dbt-core dbt-fabricsparkNo compatibility data collected yet for this library.
The quickstart involves setting up your `profiles.yml` with the `fabricspark` adapter type, specifying your Fabric workspace, lakehouse, and authentication method (typically Azure CLI). After configuring, standard `dbt` CLI commands like `dbt run` will execute transformations on your Microsoft Fabric Lakehouse. Ensure you are logged in via `az login` for CLI authentication.
Ensure you install both `dbt-core` and `dbt-fabricspark` explicitly: `pip install dbt-core dbt-fabricspark`.
Always use the `lakehouse` and `schema` fields in `profiles.yml` for targeting. Avoid setting a `database` field directly.
For models where updates or overwrites are needed, explicitly set `incremental_strategy` to `insert_overwrite` (with `partition_by`) or `merge` (with `unique_key` and Delta file format) in your model configurations. For example: `{{ config(materialized='incremental', incremental_strategy='merge', unique_key='id') }}`.In your `profiles.yml`, under your target, add `reuse_session: true` and optionally `session_id_file: ./livy-session-id.txt` to enable session reuse for faster iterative development. Example: `reuse_session: true, session_id_file: '/tmp/my-dbt-session.txt'`
Run `az login` in your terminal to refresh your Azure CLI session. For service principal authentication, ensure your client ID, tenant ID, and client secret/certificate are valid and correctly configured in `profiles.yml` or environment variables.
Inspect the macro or variable in the specified file. Check its return type and how it's being accessed. Ensure all package macros are available by running `dbt deps`.
Review the compiled SQL in `target/compiled/<project_name>/models/...` and `target/run/<project_name>/models/...`. Run the compiled SQL directly in a Spark SQL client to debug syntax. Use Spark-compatible SQL and ensure data types are correctly handled (e.g., using `CAST` functions).
For incremental models, verify the `materialized='incremental'` configuration. Ensure `incremental_strategy` is set correctly (`merge` or `insert_overwrite`) and `unique_key` and `partition_by` (if applicable) are defined in your model config. Validate the `is_incremental()` logic in your SQL for proper conditional execution.