Elementary data observability support for Microsoft Fabric Lakehouse (fabricspark adapter).
Problem: dbt Elementary is not officially supported for Microsoft Fabric Lakehouse. When trying to configure and run Elementary with the fabricspark adapter, it fails with SQL syntax errors:
Runtime Error
Database Error
[PARSE_SYNTAX_ERROR] Syntax error at or near ':': extra input ':'.(line 6, pos 21)
== SQL ==
insert into ai_fork_lake.elementary.dbt_run_results
(...)
values
(...,
current_timestamp::timestamp -- ❌ PostgreSQL syntax, not supported in Spark
Root Cause: Elementary has adapter-specific implementations for:
- ✅ snowflake, bigquery, redshift, postgres, databricks, spark, athena, trino, clickhouse, dremio
- ❌ fabricspark - Not supported
From Elementary documentation:
- CLI support: Fabric Lakehouse not listed (Elementary CLI docs)
- Paid integrations: Microsoft Fabric mentioned but unclear (Elementary integrations)
Solution: This package provides fabricspark__ macro implementations that make Elementary work with Microsoft Fabric Lakehouse by delegating to Elementary's Spark implementations.
packages:
- package: elementary-data/elementary
version: 0.22.1
- git: https://github.com/accelerate-data/vd-dbt-elementary-fabricspark.git
revision: maindispatch:
- macro_namespace: elementary
search_order:
- elementary_fabricspark # Check our package first
- elementary # Then Elementary's own macrosmodels:
elementary:
+schema: elementary
+tags: ["elementary"]dbt depsProvides 16 fabricspark__ macro implementations for Elementary:
fabricspark__edr_type_string()- Returns "string" typefabricspark__data_type_list(data_type)- Returns type lists for normalizationfabricspark__get_normalized_data_type(exact_data_type)- Type synonym handling
fabricspark__edr_current_timestamp()- Current timestamp castingfabricspark__edr_current_timestamp_in_utc()- UTC timestampfabricspark__edr_datediff(first_date, second_date, datepart)- Date difference calculationsfabricspark__edr_to_char(column, format)- Date formatting
fabricspark__edr_safe_cast(field, type)- Safe casting with try_cast
fabricspark__has_temp_table_support()- Returns false (Spark limitation)fabricspark__edr_make_temp_relation(base_relation, suffix)- Temp table namingfabricspark__create_or_replace(temporary, relation, sql_query)- Table creationfabricspark__replace_table_data(relation, rows)- Truncate and insertfabricspark__get_delete_and_insert_queries(...)- Delta merge operationsfabricspark__get_relation_max_name_length()- Returns 127 chars
fabricspark__target_database()- Returns target.catalogfabricspark__get_columns_from_information_schema(...)- Column metadata (returns empty)fabricspark__generate_elementary_profile_args(...)- Elementary profile config
fabricspark__complete_buckets_cte(...)- Time bucket generation for anomaly detectionfabricspark__get_clean_elementary_test_tables_queries(...)- Test cleanup
All macros are direct copies of Elementary's spark__ implementations with find & replace:
spark__→fabricspark__
This ensures:
- ✅ Correct parameter signatures
- ✅ Proper SQL syntax for Spark/Fabric
- ✅ Compatibility with Elementary's internal calls
- ✅ Easy updates when Elementary releases new versions
Tested with:
- ✅ Microsoft Fabric Lakehouse
- ✅ dbt-fabricspark adapter v1.9.2
- ✅ Elementary v0.22.1
- ✅ dbt-core v1.11.6
Confirmed functionality:
- ✅ All Elementary runtime tables populated (dbt_models, dbt_tests, dbt_sources, etc.)
- ✅ Anomaly detection tests execute successfully
- ✅ Metadata collection on every dbt run
- ✅ Error handling and logging
When configured, Elementary creates these tables in your elementary schema:
Core Runtime Tables:
dbt_models- Model metadata and configurationdbt_tests- Test definitions and configurationsdbt_sources- Source metadatadbt_snapshots- Snapshot configurationsdbt_invocations- dbt run metadata
Execution Tables:
model_executions- Model run resultstest_executions- Test run resultselementary_test_results- Anomaly detection results
# models/schema.yml
models:
- name: my_model
columns:
- name: id
tests:
- unique
- not_null
- elementary.column_anomalies:
column_anomalies:
- null_count
- missing_countRun your models:
dbt run
# Elementary on-run-end hook automatically populates runtime tablesQuery runtime data:
SELECT
name,
materialization,
database_name,
schema_name
FROM elementary.dbt_models
WHERE name = 'my_model';- ❌ Elementary CLI: Not supported for Fabric Lakehouse (use dbt-native Elementary features only)
⚠️ Information Schema:get_columns_from_information_schemareturns empty (Spark limitation)⚠️ Temp Tables: Fabric Spark doesn't support true temp tables (uses regular tables with temp naming)
- Use databricks flavor - Databricks adapter is different from fabricspark
- Fork Elementary - Hard to maintain, doesn't scale
- Use dbt_artifacts only - Missing anomaly detection features
- ✅ This package - Lightweight, maintainable, full Elementary support
When Elementary releases a new version:
- Check if new
spark__macros were added - Copy new macros to
fabricspark_overrides.sql - Find & replace:
spark__→fabricspark__ - Test with your project
- Update version in README
This package is maintained by the AccelerateData team for internal use but is open source.
Issues and PRs welcome at: https://github.com/accelerate-data/vd-dbt-elementary-fabricspark
MIT License - See LICENSE file
Status: ✅ Production Ready
Last Updated: 2026-02-26