Skip to content

Commit 347d3ed

Browse files
committed
adding dialect & handling temp views
1 parent 9a6c575 commit 347d3ed

File tree

4 files changed

+497
-240
lines changed

4 files changed

+497
-240
lines changed

sqlmesh/core/config/connection.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,22 +1587,28 @@ def _extra_engine_config(self) -> t.Dict[str, t.Any]:
15871587
return {"catalog_support": CatalogSupport.SINGLE_CATALOG_ONLY}
15881588

15891589

1590-
class FabricWarehouseConnectionConfig(MSSQLConnectionConfig):
1590+
class FabricConnectionConfig(MSSQLConnectionConfig):
15911591
"""
1592-
Fabric Warehouse Connection Configuration. Inherits most settings from MSSQLConnectionConfig.
1592+
Fabric Connection Configuration.
1593+
1594+
Inherits most settings from MSSQLConnectionConfig and sets the type to 'fabric'.
1595+
It is recommended to use the 'pyodbc' driver for Fabric.
15931596
"""
15941597

1595-
type_: t.Literal["fabric_warehouse"] = Field(alias="type", default="fabric_warehouse") # type: ignore
1598+
type_: t.Literal["fabric"] = Field(alias="type", default="fabric")
15961599
autocommit: t.Optional[bool] = True
15971600

15981601
@property
15991602
def _engine_adapter(self) -> t.Type[EngineAdapter]:
1600-
from sqlmesh.core.engine_adapter.fabric_warehouse import FabricWarehouseAdapter
1603+
# This is the crucial link to the adapter you already created.
1604+
from sqlmesh.core.engine_adapter.fabric import FabricAdapter
16011605

1602-
return FabricWarehouseAdapter
1606+
return FabricAdapter
16031607

16041608
@property
16051609
def _extra_engine_config(self) -> t.Dict[str, t.Any]:
1610+
# This ensures the 'database' name from the config is passed
1611+
# to the FabricAdapter's constructor.
16061612
return {
16071613
"database": self.database,
16081614
"catalog_support": CatalogSupport.REQUIRES_SET_CATALOG,

sqlmesh/core/engine_adapter/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from sqlmesh.core.engine_adapter.trino import TrinoEngineAdapter
2020
from sqlmesh.core.engine_adapter.athena import AthenaEngineAdapter
2121
from sqlmesh.core.engine_adapter.risingwave import RisingwaveEngineAdapter
22-
from sqlmesh.core.engine_adapter.fabric_warehouse import FabricWarehouseAdapter
22+
from sqlmesh.core.engine_adapter.fabric import FabricAdapter
2323

2424
DIALECT_TO_ENGINE_ADAPTER = {
2525
"hive": SparkEngineAdapter,
@@ -36,7 +36,7 @@
3636
"trino": TrinoEngineAdapter,
3737
"athena": AthenaEngineAdapter,
3838
"risingwave": RisingwaveEngineAdapter,
39-
"fabric_warehouse": FabricWarehouseAdapter,
39+
"fabric": FabricAdapter,
4040
}
4141

4242
DIALECT_ALIASES = {
@@ -47,9 +47,11 @@
4747
def create_engine_adapter(
4848
connection_factory: t.Callable[[], t.Any], dialect: str, **kwargs: t.Any
4949
) -> EngineAdapter:
50+
print(kwargs)
5051
dialect = dialect.lower()
5152
dialect = DIALECT_ALIASES.get(dialect, dialect)
5253
engine_adapter = DIALECT_TO_ENGINE_ADAPTER.get(dialect)
54+
print(engine_adapter)
5355
if engine_adapter is None:
5456
return EngineAdapter(connection_factory, dialect, **kwargs)
5557
if engine_adapter is EngineAdapterWithIndexSupport:

0 commit comments

Comments
 (0)