Skip to content

feat: Add Support For Microsoft Fabric Via SQL Endpoints#4950

Closed
mattiasthalen wants to merge 88 commits intoSQLMesh:mainfrom
mattiasthalen:feat/add-fabric-engine
Closed

feat: Add Support For Microsoft Fabric Via SQL Endpoints#4950
mattiasthalen wants to merge 88 commits intoSQLMesh:mainfrom
mattiasthalen:feat/add-fabric-engine

Conversation

@mattiasthalen
Copy link
Contributor

@mattiasthalen mattiasthalen commented Jul 10, 2025

This pull request introduces support for the Microsoft Fabric execution engine, including configuration, integration, documentation, and testing updates. The changes span multiple files to ensure Fabric is fully integrated into the system.

NOTE!
The sqlglot version is overridden during development.
Reverse commit 173e0ac before merge.

NOTE!
This replaces #4751

DEPENDENCY NOTE!
This depends on these SQLGLot PRs to be merged and the version bumped:
tobymao/sqlglot#5385
tobymao/sqlglot#5386

Fabric Engine Integration

  • Engine Adapter Implementation: Added FabricAdapter to handle Fabric-specific behavior, including the DELETE/INSERT strategy for insert_overwrite_by_condition and disabling support for transactions and indexes. (sqlmesh/core/engine_adapter/fabric.py, sqlmesh/core/engine_adapter/fabric.pyR1-R49)
  • Connection Configuration: Introduced FabricConnectionConfig inheriting from MSSQLConnectionConfig, with default settings tailored for Fabric, such as the pyodbc driver and autocommit enabled. (sqlmesh/core/config/connection.py, sqlmesh/core/config/connection.pyR1680-R1707)

Documentation Updates

  • Fabric Documentation: Created a new guide for Fabric configuration, detailing installation, connection options, and authentication methods. (docs/integrations/engines/fabric.md, docs/integrations/engines/fabric.mdR1-R32)
  • Overview and Navigation: Updated the integrations overview and navigation files to include Fabric as a supported engine. (docs/integrations/overview.md, [1]; mkdocs.yml, [2]

Testing Enhancements

  • Integration Tests: Added Fabric-specific integration tests, including connection validation, dialect behavior, and adapter functionality. (tests/core/engine_adapter/test_fabric.py, [1]; tests/core/engine_adapter/integration/config.yaml, [2]
  • Connection Config Tests: Verified default settings and parameter validation for FabricConnectionConfig, including ODBC connection string generation. (tests/core/test_connection_config.py, tests/core/test_connection_config.pyR1687-R1768)

Dependency and Build Updates

  • Pyproject Updates: Added pyodbc as a dependency for Fabric and included Fabric in test markers. (pyproject.toml, [1] [2]
  • Makefile Updates: Added a new fabric-test target for running Fabric-specific tests. (Makefile, MakefileR176-R178)

fresioAS and others added 30 commits June 17, 2025 00:45
Co-authored-by: Mattias Thalén <bitter-polders0x@icloud.com>
@mattiasthalen
Copy link
Contributor Author

@georgesittas ´tests/core/engine_adapter/test_mssql.py::test_varchar_workaround_to_max´ fails... is this redundant now that we have the varchar/char precision handling in sqlglot?

Copy link
Collaborator

@erindru erindru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @mattiasthalen, we are getting there. The integration test suite passes on the Tobiko Fabric tenant.

I've left some feedback for your consideration. It would be good to get this merged with the other PR so we can be back to having a single unified PR for Fabric support

@mattiasthalen mattiasthalen marked this pull request as ready for review July 30, 2025 06:46
@mattiasthalen mattiasthalen marked this pull request as draft July 30, 2025 06:46
@mattiasthalen
Copy link
Contributor Author

@erindru, ready from my POV ☺️

@fresioAS, when are you back?

@erindru
Copy link
Collaborator

erindru commented Jul 30, 2025

It looks like there is a regression in the unit tests:

FAILED tests/core/test_connection_config.py::test_fabric_pyodbc_connection_string_generation - pydantic_core._pydantic_core.ValidationError: 2 validation errors for FabricConnectionConfig
workspace_id
  Field required [type=missing, input_value={'host': 'testserver.data...ue, 'login_timeout': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
tenant_id
  Field required [type=missing, input_value={'host': 'testserver.data...ue, 'login_timeout': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

Do you run make fast-test prior to pushing new commits?

@mattiasthalen
Copy link
Contributor Author

It looks like there is a regression in the unit tests:

FAILED tests/core/test_connection_config.py::test_fabric_pyodbc_connection_string_generation - pydantic_core._pydantic_core.ValidationError: 2 validation errors for FabricConnectionConfig
workspace_id
  Field required [type=missing, input_value={'host': 'testserver.data...ue, 'login_timeout': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
tenant_id
  Field required [type=missing, input_value={'host': 'testserver.data...ue, 'login_timeout': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

Do you run make fast-test prior to pushing new commits?

Sorry, forgot about that one. So used to running make fabric-test now... Will fix asap.

@erindru
Copy link
Collaborator

erindru commented Aug 5, 2025

@mattiasthalen should this PR be closed and review done on the original PR ?

@mattiasthalen
Copy link
Contributor Author

Yeah, the only reason I did this PR was to hand you a preview ☺️

@mattiasthalen mattiasthalen deleted the feat/add-fabric-engine branch August 5, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants