Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 18, 2026

Description

Enables dynamic replacement of SQL Database server endpoints during deployment via $items.SQLDatabase.DB_Name.$sqlendpoint syntax in parameter files.

Problem: When deploying semantic models with Fabric SQL Database sources, only the database GUID could be replaced, not the server endpoint, breaking connections across environments.

Solution: Added SQLDatabase to PROPERTY_PATH_ATTR_MAPPING with sqlendpoint mapped to body/properties/serverFqdn, and added SQLDatabase to the property extraction logic in _refresh_deployed_items to ensure the endpoint is fetched from deployed items.

Changes

  • src/fabric_cicd/constants.py: Added SQLDatabase entry to property path mapping
  • src/fabric_cicd/fabric_workspace.py: Added SQLDatabase to property extraction in _refresh_deployed_items method to fetch sqlendpoint values from the Fabric API. Simplified the property extraction logic by removing redundant type checks - the _get_item_attribute method already validates attribute support.
  • docs/how_to/parameterization.md: Updated documentation table in the "Dynamic Replacement" section to include SQLDatabase as a supported item type for the $sqlendpoint attribute
  • tests/test_parameter_utils.py: Added test coverage for SQLDatabase sqlendpoint extraction

Usage

find_replace:
  - find_value: "dev-server.database.fabric.microsoft.com,1433"
    replace_value:
      prod: "$items.SQLDatabase.DB_Name.$sqlendpoint"

The system will fetch the serverFqdn property via GET /v1/workspaces/{id}/sqldatabases/{id} and replace the find_value with the target database's endpoint.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Support $items.<item_type>.<item_name>.$sqlendpoint for a Fabric SQL Database</issue_title>
<issue_description>### What is the feature?

Gap

When deploying a semantic model that has a Fabric SQL Database as source, I would like to change the SQL Database to the one in the production workspace.
Currently, I can only replace the GUID of the database name, like 'DB_Name-<DEV-GUID>' to 'DB_Name-<PROD-GUID>' with a simple find_replace but not the server name in a find_replace, which leads to a broken connection.

Ideal solution

Ideally, I would use something like this:

find_replace:
    # This one doesn't work:
    - find_value: "dev-server-name.database.fabric.microsoft.com,1433"
      replace_value:
          test: "$workspace.Workspace Test.$items.SQLDatabase.DB_Name.$sqlendpoint"
          prod: "$workspace.Workspace Prod.$items.SQLDatabase.DB_Name.$sqlendpoint"

    # This one works already:
    - find_value: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      replace_value:
          test: "$workspace.Workspace Test.$items.SQLDatabase.DB_Name.$id"
          prod: "$workspace.Workspace Prod.$items.SQLDatabase.DB_Name.$id"

Additional context

A table in the semantic model eventually looks like the following:

table Date
	lineageTag: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

	column Date
		dataType: dateTime
		isNullable: false
		formatString: Long Date
		sourceProviderType: date
		lineageTag: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
		summarizeBy: none
		sourceColumn: Date

		annotation SummarizationSetBy = Automatic

		annotation UnderlyingDateTimeDataType = Date

	partition Date-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx = m
		mode: dual
		source =
				let
				    Source = Sql.Database("dev-server-name.database.fabric.microsoft.com,1433", "DB_Name-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
				    PBI_vw_dim_date = Source{[Schema="PBI",Item="vw_dim_date"]}[Data]
				in
				    PBI_vw_dim_date

	annotation PBI_ResultType = Table

	annotation PBI_NavigationStepName = Navigation

I can achieve the replacement by monkey-patching the library like so:

from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items, append_feature_flag, change_log_level
from fabric_cicd.constants import PROPERTY_PATH_ATTR_MAPPING

# Monkey patch to include sqlendpoint as serverFqdn in parameter replacement
if "SQLDatabase" not in PROPERTY_PATH_ATTR_MAPPING:
    PROPERTY_PATH_ATTR_MAPPING["SQLDatabase"] = {
        "sqlendpoint": "body/properties/serverFqdn",
    }

# Set log level to DEBUG for more detailed logs
change_log_level("DEBUG")

# Enable the deployment of shortcuts
append_feature_flag("enable_shortcut_publish")

# Initialize the FabricWorkspace object with the required parameters
target_workspace = FabricWorkspace(
    workspace_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    environment = "prod",
    repository_directory = r"/path/to/my/repository",
)

# Publish all items defined in item_type_in_scope
publish_all_items(target_workspace)

# Unpublish all items defined in item_type_in_scope not found in repository
unpublish_all_orphan_items(target_workspace)
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for $items.<item_type>.<item_name>.$sqlendpoint in Fabric SQL Database Fixes #720 - Add support for SQLDatabase.$sqlendpoint parameter replacement Jan 18, 2026
Copilot AI requested a review from shirasassoon January 18, 2026 09:35
@shirasassoon
Copy link
Contributor

@copilot Why is SQLDatabase item explicitly referenced in refresh_deployed_items where properties are extracted?

Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@copilot Why is SQLDatabase item explicitly referenced in refresh_deployed_items where properties are extracted?

SQLDatabase needs to be explicitly referenced in _refresh_deployed_items to extract its sqlendpoint property when querying deployed items in the workspace. Without this, the property wouldn't be available for parameter replacement.

This is the same pattern used for Lakehouse and Warehouse items (lines 368-374) and Eventhouse items (lines 375-378).

Fixed in commit 5881f0d by adding SQLDatabase to the property extraction list.

Copy link
Contributor

@shirasassoon shirasassoon left a comment

Choose a reason for hiding this comment

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

@copilot Review the comment and update documentation in parameterization to include this new variable support.

Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@copilot Review the comment and update documentation in parameterization to include this new variable support.

Updated the parameterization documentation in commit 4c7c54d. The documentation now shows SQLDatabase as a supported item type for the $sqlendpoint attribute in the "Dynamic Replacement" section's attribute table.

Copilot AI requested a review from shirasassoon January 18, 2026 13:48
@shirasassoon shirasassoon marked this pull request as ready for review January 18, 2026 19:17
@shirasassoon shirasassoon requested a review from a team as a code owner January 18, 2026 19:17
Copilot AI review requested due to automatic review settings January 18, 2026 19:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for dynamic SQL Database endpoint replacement during deployment, enabling users to replace server endpoints (not just database GUIDs) when deploying semantic models with Fabric SQL Database sources across environments.

Changes:

  • Added SQLDatabase to the property path attribute mapping with sqlendpoint mapped to body/properties/serverFqdn
  • Extended property extraction logic to fetch SQL endpoints for SQLDatabase items from the Fabric API
  • Updated documentation to reflect SQLDatabase as a supported item type for $sqlendpoint attribute
  • Added comprehensive test coverage for SQLDatabase sqlendpoint extraction

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/fabric_cicd/constants.py Added SQLDatabase entry to PROPERTY_PATH_ATTR_MAPPING with sqlendpoint mapped to serverFqdn property
src/fabric_cicd/fabric_workspace.py Extended property extraction in _refresh_deployed_items to include SQLDatabase alongside Lakehouse and Warehouse
docs/how_to/parameterization.md Updated dynamic replacement table to include SQLDatabase as supported item type for $sqlendpoint
tests/test_parameter_utils.py Added mock SQLDatabase data and test cases for sqlendpoint extraction with both legacy and new syntax

@shirasassoon shirasassoon merged commit 24233ec into main Jan 19, 2026
15 checks passed
@shirasassoon shirasassoon deleted the copilot/add-support-for-sqlendpoint branch January 19, 2026 12:52
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.

Feature Request: Support $items.<item_type>.<item_name>.$sqlendpoint for a Fabric SQL Database

3 participants