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): show source name in SQL editor connection picker (#73944)

Tom Owers6e27c201f9dd
diff --git a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
index 35cf3b377eca..0e2bff859063 100644
--- a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
+++ b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
@@ -206,12 +206,12 @@ export const connectionSelectorLogic = kea<connectionSelectorLogicType>([
: (connectionOptions ?? []).map((source) => {
const engine = getConnectionEngine(source)
const isSynced = source.access_method === 'warehouse'
+ // Prefer the user-set description, then the prefix; fall back to the source type name (never the raw UUID).
+ const name = source.description || source.prefix || source.source_type || source.id
return {
value: source.id,
- label: `${source.prefix ? source.prefix : source.id} (${ENGINE_LABELS[engine]}${
- isSynced ? ' · synced' : ''
- })`,
+ label: `${name} (${ENGINE_LABELS[engine]}${isSynced ? ' · synced' : ''})`,
iconSrc: ENGINE_ICONS[engine],
managementUrl: urls.dataWarehouseSource(`managed-${source.id}`),
}
diff --git a/products/warehouse_sources/backend/presentation/views/external_data_source.py b/products/warehouse_sources/backend/presentation/views/external_data_source.py
index dac801aab10c..ba77eeb342a6 100644
--- a/products/warehouse_sources/backend/presentation/views/external_data_source.py
+++ b/products/warehouse_sources/backend/presentation/views/external_data_source.py
@@ -556,6 +556,11 @@ class ExternalDataSourceConnectionOptionSerializer(serializers.ModelSerializer):
supports_hogql = serializers.SerializerMethodField(
help_text="Whether HogQL queries compile for this connection. When false, only raw SQL (sendRawQuery) works.",
)
+ description = serializers.CharField(
+ read_only=True,
+ allow_null=True,
+ help_text="User-set description of the source, shown as its display name in the connection picker when set.",
+ )
@extend_schema_field(serializers.BooleanField())
def get_supports_hogql(self, source: ExternalDataSource) -> bool:
@@ -566,8 +571,8 @@ class ExternalDataSourceConnectionOptionSerializer(serializers.ModelSerializer):
class Meta:
model = ExternalDataSource
- fields = ["id", "prefix", "engine", "source_type", "access_method", "supports_hogql"]
- read_only_fields = ["id", "prefix", "engine", "source_type", "access_method", "supports_hogql"]
+ fields = ["id", "prefix", "engine", "source_type", "access_method", "supports_hogql", "description"]
+ read_only_fields = ["id", "prefix", "engine", "source_type", "access_method", "supports_hogql", "description"]
class ExternalDataSourceBulkUpdateSchemaSerializer(serializers.Serializer):
diff --git a/products/warehouse_sources/backend/tests/api/test_external_data_source.py b/products/warehouse_sources/backend/tests/api/test_external_data_source.py
index b85b9d973d0d..fd41a0c11da1 100644
--- a/products/warehouse_sources/backend/tests/api/test_external_data_source.py
+++ b/products/warehouse_sources/backend/tests/api/test_external_data_source.py
@@ -2207,6 +2207,7 @@ class TestExternalDataSource(APIBaseTest):
source_type="Postgres",
created_by=self.user,
prefix="Primary database",
+ description="Prod Postgres replica",
access_method=ExternalDataSource.AccessMethod.DIRECT,
job_inputs={"host": "localhost", "password": "secret"},
connection_metadata={"engine": "duckdb", "database": "ducklake", "available_functions": ["date_bin"]},
@@ -2250,6 +2251,7 @@ class TestExternalDataSource(APIBaseTest):
"source_type": "Snowflake",
"access_method": "direct",
"supports_hogql": True,
+ "description": None,
},
{
"id": str(postgres_source.pk),
@@ -2258,6 +2260,7 @@ class TestExternalDataSource(APIBaseTest):
"source_type": "Postgres",
"access_method": "direct",
"supports_hogql": True,
+ "description": "Prod Postgres replica",
},
{
"id": str(mysql_source.pk),
@@ -2266,6 +2269,7 @@ class TestExternalDataSource(APIBaseTest):
"source_type": "MySQL",
"access_method": "direct",
"supports_hogql": True,
+ "description": None,
},
],
)
diff --git a/products/warehouse_sources/frontend/generated/api.schemas.ts b/products/warehouse_sources/frontend/generated/api.schemas.ts
index dbfee31cee37..fb12593c31b1 100644
--- a/products/warehouse_sources/frontend/generated/api.schemas.ts
+++ b/products/warehouse_sources/frontend/generated/api.schemas.ts
@@ -5808,6 +5808,11 @@ export interface ExternalDataSourceConnectionOptionApi {
readonly access_method: AccessMethodEnumApi
/** Whether HogQL queries compile for this connection. When false, only raw SQL (sendRawQuery) works. */
readonly supports_hogql: boolean
+ /**
+ * User-set description of the source, shown as its display name in the connection picker when set.
+ * @nullable
+ */
+ readonly description: string | null
}
/**
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 40f46e03fddc..0d636bade5f0 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -28356,6 +28356,11 @@ export namespace Schemas {
readonly access_method: AccessMethodEnum;
/** Whether HogQL queries compile for this connection. When false, only raw SQL (sendRawQuery) works. */
readonly supports_hogql: boolean;
+ /**
+ * User-set description of the source, shown as its display name in the connection picker when set.
+ * @nullable
+ */
+ readonly description: string | null;
}
/**