Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): find Microsoft SQL Server when searching for Azure SQL (#93447)

Tom Owersf5d6d8382eed
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py
index 0f35eeb2d6f7..78381471e851 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py
@@ -182,7 +182,9 @@ class MSSQLSource(SQLSource[MSSQLSourceConfig], SSHTunnelMixin, ValidateDatabase
return SourceConfig(
name=SchemaExternalDataSourceType.MSSQL,
category=DataWarehouseSourceCategory.DATABASES,
- keywords=["sql server", "sql", "mssql"],
+ # This connector is also how you connect Azure SQL Database, but nothing in the label
+ # or name carries "Azure", so a search for it fuzzy-matched unrelated sources instead.
+ keywords=["sql server", "sql", "mssql", "azure", "azure sql", "azure sql database"],
label="Microsoft SQL Server",
caption="Enter your Microsoft SQL Server/Azure SQL Server credentials to automatically pull your SQL data into the PostHog Data warehouse.",
iconPath="/static/services/sql-azure.png",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py
index 04da731bb1d0..4777078e80bf 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py
@@ -730,6 +730,17 @@ class TestMSSQLSourceNonRetryableErrors:
assert any(pattern in str(exc_info.value) for pattern in non_retryable.keys())
+class TestMSSQLSourceCatalogKeywords:
+ @pytest.mark.parametrize("term", ["azure", "azure sql", "azure sql database"])
+ def test_azure_sql_names_are_searchable(self, term):
+ # Azure SQL Database connects through this source, and the catalog search only matches a
+ # source's label, name, and keywords — none of which mention Azure without the keywords.
+ config = MSSQLSource().get_source_config
+ searchable = [config.label or "", str(config.name), *(config.keywords or [])]
+
+ assert any(term in text.lower() for text in searchable), term
+
+
class TestMSSQLSourceRetryableErrors:
@pytest.mark.parametrize(
"error",