Skip to content

Commit e693baf

Browse files
fix(fabric): Update docs and add id to parameter names
1 parent 148915a commit e693baf

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

docs/integrations/engines/fabric.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ pip install "sqlmesh[fabric]"
2929
| `autocommit` | Is autocommit mode enabled. Default: false | bool | N |
3030
| `driver` | The driver to use for the connection. Default: pyodbc | string | N |
3131
| `driver_name` | The driver name to use for the connection. E.g., *ODBC Driver 18 for SQL Server* | string | N |
32-
| `tenant` | The Fabric tenant UUID | string | Y |
33-
| `workspace` | The Fabric workspace UUID | string | Y |
32+
| `tenant_id` | The Azure / Entra tenant UUID | string | Y |
33+
| `workspace_id` | The Fabric workspace UUID. The preferred way to retrieve it is by running `notebookutils.runtime.context.get("currentWorkspaceId")` in a python notebook. | string | Y |
3434
| `odbc_properties` | The dict of ODBC connection properties. E.g., authentication: ActiveDirectoryServicePrincipal. See more [here](https://learn.microsoft.com/en-us/sql/connect/odbc/dsn-connection-string-attribute?view=sql-server-ver16). | dict | N |

sqlmesh/core/config/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,8 @@ class FabricConnectionConfig(MSSQLConnectionConfig):
17081708
DISPLAY_NAME: t.ClassVar[t.Literal["Fabric"]] = "Fabric" # type: ignore
17091709
DISPLAY_ORDER: t.ClassVar[t.Literal[17]] = 17 # type: ignore
17101710
driver: t.Literal["pyodbc"] = "pyodbc"
1711-
workspace: str
1712-
tenant: str
1711+
workspace_id: str
1712+
tenant_id: str
17131713
autocommit: t.Optional[bool] = True
17141714

17151715
@property
@@ -1723,8 +1723,8 @@ def _extra_engine_config(self) -> t.Dict[str, t.Any]:
17231723
return {
17241724
"database": self.database,
17251725
"catalog_support": CatalogSupport.FULL_SUPPORT,
1726-
"workspace": self.workspace,
1727-
"tenant": self.tenant,
1726+
"workspace_id": self.workspace_id,
1727+
"tenant_id": self.tenant_id,
17281728
"user": self.user,
17291729
"password": self.password,
17301730
}

sqlmesh/core/engine_adapter/fabric.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _insert_overwrite_by_condition(
8282

8383
def _get_access_token(self) -> str:
8484
"""Get access token using Service Principal authentication."""
85-
tenant_id = self._extra_config.get("tenant")
85+
tenant_id = self._extra_config.get("tenant_id")
8686
client_id = self._extra_config.get("user")
8787
client_secret = self._extra_config.get("password")
8888

@@ -127,14 +127,14 @@ def _make_fabric_api_request(
127127
if not requests:
128128
raise SQLMeshError("requests library is required for Fabric catalog operations")
129129

130-
workspace = self._extra_config.get("workspace")
131-
if not workspace:
130+
workspace_id = self._extra_config.get("workspace_id")
131+
if not workspace_id:
132132
raise SQLMeshError(
133-
"workspace parameter is required in connection config for Fabric catalog operations"
133+
"workspace_id parameter is required in connection config for Fabric catalog operations"
134134
)
135135

136136
base_url = "https://api.fabric.microsoft.com/v1"
137-
url = f"{base_url}/workspaces/{workspace}/{endpoint}"
137+
url = f"{base_url}/workspaces/{workspace_id}/{endpoint}"
138138

139139
headers = self._get_fabric_auth_headers()
140140

@@ -177,14 +177,14 @@ def _make_fabric_api_request_with_location(
177177
if not requests:
178178
raise SQLMeshError("requests library is required for Fabric catalog operations")
179179

180-
workspace = self._extra_config.get("workspace")
181-
if not workspace:
180+
workspace_id = self._extra_config.get("workspace_id")
181+
if not workspace_id:
182182
raise SQLMeshError(
183-
"workspace parameter is required in connection config for Fabric catalog operations"
183+
"workspace_id parameter is required in connection config for Fabric catalog operations"
184184
)
185185

186186
base_url = "https://api.fabric.microsoft.com/v1"
187-
url = f"{base_url}/workspaces/{workspace}/{endpoint}"
187+
url = f"{base_url}/workspaces/{workspace_id}/{endpoint}"
188188
headers = self._get_fabric_auth_headers()
189189

190190
try:
@@ -445,10 +445,7 @@ def _ensure_schema_exists(self, table_name: TableName) -> None:
445445
catalog_name = table.catalog
446446

447447
# Build the full schema name
448-
if catalog_name:
449-
full_schema_name = f"{catalog_name}.{schema_name}"
450-
else:
451-
full_schema_name = schema_name
448+
full_schema_name = f"{catalog_name}.{schema_name}" if catalog_name else schema_name
452449

453450
logger.debug(f"Ensuring schema exists: {full_schema_name}")
454451

tests/core/engine_adapter/integration/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ gateways:
194194
user: {{ env_var("FABRIC_CLIENT_ID") }}
195195
password: {{ env_var("FABRIC_CLIENT_SECRET") }}
196196
database: {{ env_var("FABRIC_DATABASE") }}
197-
tenant: {{ env_var("FABRIC_TENANT") }}
198-
workspace: {{ env_var("FABRIC_WORKSPACE") }}
197+
tenant_id: {{ env_var("FABRIC_TENANT_ID") }}
198+
workspace_id: {{ env_var("FABRIC_WORKSPACE_ID") }}
199199
odbc_properties:
200200
Authentication: ActiveDirectoryServicePrincipal
201201
state_connection:

0 commit comments

Comments
 (0)