Connector
MSSQL
Feature area
Metadata ingestion
Describe the bug
When ingesting metadata from a Microsoft SQL Server instance with multiple databases that contain tables with identical names but different schemas (e.g., different column names for parent table), the ingestion pipeline incorrectly resolves the referredColumns for foreign key constraints. The referred database is set to the wrong database, leading to an Invalid column name error during the patch operation.
In the logs, the following warning appears:
WARNING - patch_mixin.py:193 - Failed to update Table [test_ChildTable]. The patch operation was skipped. Reason: Invalid column name ParentKey
The tableConstraints for the foreign key are incorrectly generated as:
"referredColumns": ["test_service.DWH.dbo.test_ParentTable.ParentKey"]
instead of the correct:
"referredColumns": ["test_service.statdb.dbo.test_ParentTable.ParentKey"]
To Reproduce
Create Database DWH with the following tables:
USE DWH;
CREATE TABLE dbo.test_ParentTable (
ID INT IDENTITY(1,1) PRIMARY KEY,
Name NVARCHAR(100) NOT NULL
);
CREATE TABLE dbo.test_ChildTable (
ID INT IDENTITY(1,1) PRIMARY KEY,
ParentID INT NOT NULL,
Description NVARCHAR(200),
CONSTRAINT FK_Child_Parent FOREIGN KEY (ParentID) REFERENCES dbo.test_ParentTable(ID)
);
Create Database statdb with similar tables but different column names:
USE statdb;
CREATE TABLE dbo.test_ParentTable (
ParentKey INT IDENTITY(1,1) PRIMARY KEY,
ParentName NVARCHAR(100) NOT NULL
);
CREATE TABLE dbo.test_ChildTable (
ID INT IDENTITY(1,1) PRIMARY KEY,
ParentID INT NOT NULL,
Description NVARCHAR(200),
CONSTRAINT FK_Child_Parent FOREIGN KEY (ParentID) REFERENCES dbo.test_ParentTable(ParentKey)
);
Run the OpenMetadata metadata ingestion workflow for the MSSQL service that includes both databases.
Observe the warning in the ingestion logs indicating a failure to update the table due to Invalid column name ParentKey.
Expected behavior
The ingestion should correctly resolve the foreign key constraint for statdb.dbo.test_ChildTable, identifying statdb.dbo.test_ParentTable.ParentKey as the referenced column. The tableConstraints should reflect the correct database and column names, and the ingestion should complete without errors.
Connection / ingestion config
Logs
[2026-08-03T13:51:34.332318Z] INFO - common_db_source.py:156 - Ingesting from database: DWH
[2026-08-03T13:51:52.572117Z] INFO - database_service.py:887 - Mark Deleted Schemas set to True. Processing database [DWH]
[2026-08-03T13:51:52.603978Z] INFO - database_service.py:801 - Mark Deleted Tables set to True. Processing database [DWH]
[2026-08-03T13:51:52.811547Z] INFO - database_service.py:822 - Mark Deleted Stored Procedures Processing database [DWH]
[2026-08-03T13:51:53.028738Z] INFO - common_db_source.py:156 - Ingesting from database: statdb
[2026-08-03T13:52:29.086994Z] WARNING - patch_mixin.py:193 - Failed to update Table [test_ChildTable]. The patch operation was skipped. Reason: Invalid column name ParentKey
[2026-08-03T13:52:34.023945Z] INFO - base.py:387 - Mssql: Processed 0 records, updated 52 records, filtered 276 records, found 0 errors
[2026-08-03T13:52:34.024268Z] INFO - base.py:387 - OpenMetadata: Processed 0 records, updated 43 records, filtered 0 records, found 0 errors
[2026-08-03T13:52:44.510259Z] INFO - database_service.py:887 - Mark Deleted Schemas set to True. Processing database [statdb]
[2026-08-03T13:52:44.540545Z] INFO - database_service.py:801 - Mark Deleted Tables set to True. Processing database [statdb]
[2026-08-03T13:52:44.990163Z] INFO - database_service.py:822 - Mark Deleted Stored Procedures Processing database [statdb]
OS
No response
Python version
3.10.19
OpenMetadata version
1.12.3
OpenMetadata Ingestion package version
INFO - server_mixin.py:97 - OpenMetadata client running with Server version [1.12.3] and Client version [1.12.11.1]
Additional context
No response
Pre-submission checklist
Connector
MSSQL
Feature area
Metadata ingestion
Describe the bug
When ingesting metadata from a Microsoft SQL Server instance with multiple databases that contain tables with identical names but different schemas (e.g., different column names for parent table), the ingestion pipeline incorrectly resolves the referredColumns for foreign key constraints. The referred database is set to the wrong database, leading to an Invalid column name error during the patch operation.
In the logs, the following warning appears:
The tableConstraints for the foreign key are incorrectly generated as:
"referredColumns": ["test_service.DWH.dbo.test_ParentTable.ParentKey"]instead of the correct:
"referredColumns": ["test_service.statdb.dbo.test_ParentTable.ParentKey"]To Reproduce
Create Database DWH with the following tables:
Create Database statdb with similar tables but different column names:
Run the OpenMetadata metadata ingestion workflow for the MSSQL service that includes both databases.
Observe the warning in the ingestion logs indicating a failure to update the table due to Invalid column name ParentKey.
Expected behavior
The ingestion should correctly resolve the foreign key constraint for statdb.dbo.test_ChildTable, identifying statdb.dbo.test_ParentTable.ParentKey as the referenced column. The tableConstraints should reflect the correct database and column names, and the ingestion should complete without errors.
Connection / ingestion config
Logs
OS
No response
Python version
3.10.19
OpenMetadata version
1.12.3
OpenMetadata Ingestion package version
INFO - server_mixin.py:97 - OpenMetadata client running with Server version [1.12.3] and Client version [1.12.11.1]
Additional context
No response
Pre-submission checklist