: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-warehouse): mark connections action non-paginated in schema (#70566)
Daniel RCeac3f19b3ce0
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex eb0bdae5b2f3..789114a2da92 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -138,7 +138,6 @@ import {ExternalDataJob,ExternalDataSchemaWithSource,ExternalDataSource,- ExternalDataSourceConnectionOption,ExternalDataSourceCreatePayload,ExternalDataSourceRevenueAnalyticsConfig,ExternalDataSourceSchema,@@ -1802,10 +1801,6 @@ export class ApiRequest {return this.externalDataSources(teamId).addPathComponent(sourceId)}- public externalDataSourceConnections(teamId?: TeamType['id']): ApiRequest {- return this.externalDataSources(teamId).addPathComponent('connections')- }-public externalDataSchemas(teamId?: TeamType['id']): ApiRequest {return this.environmentsDetail(teamId).addPathComponent('external_data_schemas')}@@ -5879,9 +5874,6 @@ const api = {async list(options?: ApiMethodOptions | undefined): Promise<PaginatedResponse<ExternalDataSource>> {return await new ApiRequest().externalDataSources().get(options)},- async connections(options?: ApiMethodOptions | undefined): Promise<ExternalDataSourceConnectionOption[]> {- return await new ApiRequest().externalDataSourceConnections().get(options)- },async get(sourceId: ExternalDataSource['id']): Promise<ExternalDataSource> {return await new ApiRequest().externalDataSource(sourceId).get()},diff --git a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.tsindex b28ba4e78cd0..d1218c50cfe9 100644--- a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts+++ b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts@@ -1,10 +1,11 @@import { expectLogic } from 'kea-test-utils'-import api from 'lib/api'import { urls } from 'scenes/urls'import { initKeaTests } from '~/test/init'+import { externalDataSourcesConnectionsList } from 'products/warehouse_sources/frontend/generated/api'+import {connectionSelectorLogic,getConnectionSelectorValue,@@ -12,23 +13,28 @@ import {POSTHOG_WAREHOUSE,} from './connectionSelectorLogic'+jest.mock('products/warehouse_sources/frontend/generated/api', () => ({+ externalDataSourcesConnectionsList: jest.fn(),+}))++const mockConnectionsList = externalDataSourcesConnectionsList as jest.Mock+describe('connectionSelectorLogic', () => {let logic: ReturnType<typeof connectionSelectorLogic.build>beforeEach(() => {initKeaTests()- jest.spyOn(api.externalDataSources, 'connections').mockResolvedValue([+ mockConnectionsList.mockReset().mockResolvedValue([{id: 'conn-123',prefix: 'warehouse',engine: 'postgres',},- ] as any)+ ])})afterEach(() => {logic?.unmount()- jest.restoreAllMocks()})it('loads connection options on mount', async () => {@@ -37,7 +43,7 @@ describe('connectionSelectorLogic', () => {await expectLogic(logic).toFinishAllListeners()- expect(api.externalDataSources.connections).toHaveBeenCalledTimes(1)+ expect(mockConnectionsList).toHaveBeenCalledTimes(1)expect(logic.values.connectionSelectOptions[0].options).toEqual(expect.arrayContaining([expect.objectContaining({ value: POSTHOG_WAREHOUSE }),diff --git a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.tsindex 14d128d43ab4..7650fc9b3df8 100644--- a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts+++ b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts@@ -1,11 +1,9 @@import { afterMount, connect, kea, listeners, path, selectors } from 'kea'import { loaders } from 'kea-loaders'-import api from 'lib/api'+import { ApiConfig } from 'lib/api'import { urls } from 'scenes/urls'-import type { ExternalDataSourceConnectionOption } from '~/types'-import IconPostHog from 'public/posthog-icon.svg'import IconDuckDB from 'public/services/duckdb.svg'import IconMySQL from 'public/services/mysql.png'@@ -14,6 +12,8 @@ import IconRedshift from 'public/services/redshift.png'import IconSnowflake from 'public/services/snowflake.png'import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics/sourcesDataLogic'+import { externalDataSourcesConnectionsList } from 'products/warehouse_sources/frontend/generated/api'+import type { ExternalDataSourceConnectionOptionApi } from 'products/warehouse_sources/frontend/generated/api.schemas'import type { connectionSelectorLogicType } from './connectionSelectorLogicType'@@ -57,7 +57,7 @@ const ENGINE_ICONS: Record<ConnectionEngine, string> = {redshift: IconRedshift,}-function getConnectionEngine(source: Pick<ExternalDataSourceConnectionOption, 'engine'>): ConnectionEngine {+function getConnectionEngine(source: Pick<ExternalDataSourceConnectionOptionApi, 'engine'>): ConnectionEngine {if (source.engine === 'duckdb' ||source.engine === 'mysql' ||@@ -70,7 +70,7 @@ function getConnectionEngine(source: Pick<ExternalDataSourceConnectionOption, 'e}export function getConnectionSelectorValue(- connectionOptions: ExternalDataSourceConnectionOption[] | null,+ connectionOptions: ExternalDataSourceConnectionOptionApi[] | null,connectionOptionsLoading: boolean,selectedConnectionId: string | undefined): string {@@ -92,11 +92,13 @@ export const connectionSelectorLogic = kea<connectionSelectorLogicType>([})),loaders(() => ({connectionOptions: [- null as ExternalDataSourceConnectionOption[] | null,+ null as ExternalDataSourceConnectionOptionApi[] | null,{- loadConnectionOptions: async (): Promise<ExternalDataSourceConnectionOption[]> => {+ loadConnectionOptions: async (): Promise<ExternalDataSourceConnectionOptionApi[]> => {try {- return await api.externalDataSources.connections()+ // The projects route treats the path param as a team id (environments transition),+ // so pass the current team id to keep per-environment scoping.+ return await externalDataSourcesConnectionsList(String(ApiConfig.getCurrentTeamId()))} catch (error: any) {if (error?.status === 403) {return []@@ -112,7 +114,7 @@ export const connectionSelectorLogic = kea<connectionSelectorLogicType>([connectionSelectOptions: [(s) => [s.connectionOptions, s.connectionOptionsLoading],(- connectionOptions: ExternalDataSourceConnectionOption[] | null,+ connectionOptions: ExternalDataSourceConnectionOptionApi[] | null,connectionOptionsLoading: boolean): ConnectionSelectOptionGroup[] => {const sourceOptions = connectionOptionsLoadingdiff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 13a2f5ae7484..e2815cadbcca 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -6159,12 +6159,6 @@ export interface ExternalDataSourceConnectionMetadata {available_functions?: string[]}-export interface ExternalDataSourceConnectionOption {- id: string- prefix: string | null- engine?: 'duckdb' | 'postgres' | 'mysql' | 'snowflake' | 'redshift' | null-}-export interface ExternalDataSource {id: stringsource_id: stringdiff --git a/products/data_warehouse/backend/presentation/views/external_data_source.py b/products/data_warehouse/backend/presentation/views/external_data_source.pyindex d1f00b4a13f5..93f3468206e1 100644--- a/products/data_warehouse/backend/presentation/views/external_data_source.py+++ b/products/data_warehouse/backend/presentation/views/external_data_source.py@@ -4303,7 +4303,7 @@ class ExternalDataSourceViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixireturn Response(status=status.HTTP_200_OK, data=SourceConnectLinkSerializer(data).data)@extend_schema(responses=ExternalDataSourceConnectionOptionSerializer(many=True))- @action(methods=["GET"], detail=False)+ @action(methods=["GET"], detail=False, pagination_class=None, filter_backends=[])def connections(self, request: Request, *args: Any, **kwargs: Any) -> Response:queryset = (ExternalDataSource._base_manager.filter(diff --git a/products/warehouse_sources/frontend/generated/api.schemas.ts b/products/warehouse_sources/frontend/generated/api.schemas.tsindex 41d0da2cb986..ec181ce009b5 100644--- a/products/warehouse_sources/frontend/generated/api.schemas.ts+++ b/products/warehouse_sources/frontend/generated/api.schemas.ts@@ -3768,15 +3768,6 @@ export interface ExternalDataSourceConnectionOptionApi {readonly supports_hogql: boolean}-export interface PaginatedExternalDataSourceConnectionOptionListApi {- count: number- /** @nullable */- next?: string | null- /** @nullable */- previous?: string | null- results: ExternalDataSourceConnectionOptionApi[]-}-/*** Validate credentials and preview available tables from a remote database.*@@ -7142,21 +7133,6 @@ export type ExternalDataSourcesConnectLinkRetrieveParams = {source_type: string}-export type ExternalDataSourcesConnectionsListParams = {- /**- * Number of results to return per page.- */- limit?: number- /**- * The initial index from which to return the results.- */- offset?: number- /**- * A search term.- */- search?: string-}-export type ExternalDataSourcesOauthAccountsRetrieveParams = {/*** The OAuth integration id whose accounts should be listed.diff --git a/products/warehouse_sources/frontend/generated/api.ts b/products/warehouse_sources/frontend/generated/api.tsindex db5f937520ec..9918485e7389 100644--- a/products/warehouse_sources/frontend/generated/api.ts+++ b/products/warehouse_sources/frontend/generated/api.ts@@ -15,12 +15,12 @@ import type {ExternalDataSchemaApi,ExternalDataSchemasListParams,ExternalDataSchemasLogsRetrieveParams,+ ExternalDataSourceConnectionOptionApi,ExternalDataSourceCreateApi,ExternalDataSourceSerializersApi,ExternalDataSourcesBulkUpdateSchemasPartialUpdateParams,ExternalDataSourcesCheckCdcPrerequisitesCreate200,ExternalDataSourcesConnectLinkRetrieveParams,- ExternalDataSourcesConnectionsListParams,ExternalDataSourcesListParams,ExternalDataSourcesOauthAccountsRetrieveParams,ExternalDataSourcesRepairCdcCreate200,@@ -28,7 +28,6 @@ import type {ExternalDataSourcesWizardRetrieveParams,IntegrationAccountsResponseApi,PaginatedExternalDataSchemaListApi,- PaginatedExternalDataSourceConnectionOptionListApi,PaginatedExternalDataSourceSerializersListApi,PatchedExternalDataSchemaApi,PatchedExternalDataSourceBulkUpdateSchemasApi,@@ -843,23 +842,8 @@ export const externalDataSourcesConnectLinkRetrieve = async (})}-export const getExternalDataSourcesConnectionsListUrl = (- projectId: string,- params?: ExternalDataSourcesConnectionsListParams-) => {- const normalizedParams = new URLSearchParams()-- Object.entries(params || {}).forEach(([key, value]) => {- if (value !== undefined) {- normalizedParams.append(key, value === null ? 'null' : String(value))- }- })-- const stringifiedParams = normalizedParams.toString()-- return stringifiedParams.length > 0- ? `/api/projects/${projectId}/external_data_sources/connections/?${stringifiedParams}`- : `/api/projects/${projectId}/external_data_sources/connections/`+export const getExternalDataSourcesConnectionsListUrl = (projectId: string) => {+ return `/api/projects/${projectId}/external_data_sources/connections/`}/**@@ -867,16 +851,12 @@ export const getExternalDataSourcesConnectionsListUrl = (*/export const externalDataSourcesConnectionsList = async (projectId: string,- params?: ExternalDataSourcesConnectionsListParams,options?: RequestInit-): Promise<PaginatedExternalDataSourceConnectionOptionListApi> => {- return apiMutator<PaginatedExternalDataSourceConnectionOptionListApi>(- getExternalDataSourcesConnectionsListUrl(projectId, params),- {- ...options,- method: 'GET',- }- )+): Promise<ExternalDataSourceConnectionOptionApi[]> => {+ return apiMutator<ExternalDataSourceConnectionOptionApi[]>(getExternalDataSourcesConnectionsListUrl(projectId), {+ ...options,+ method: 'GET',+ })}export const getExternalDataSourcesDatabaseSchemaCreateUrl = (projectId: string) => {diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex cf4715a65d5e..6b5e193219f4 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -36253,15 +36253,6 @@ export namespace Schemas {results: ExternalDataSchema[];}- export interface PaginatedExternalDataSourceConnectionOptionList {- count: number;- /** @nullable */- next?: string | null;- /** @nullable */- previous?: string | null;- results: ExternalDataSourceConnectionOption[];- }-export interface PaginatedExternalDataSourceSerializersList {count: number;/** @nullable */@@ -64065,21 +64056,6 @@ export namespace Schemas {source_type: string;};- export type EnvironmentsExternalDataSourcesConnectionsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-export type EnvironmentsExternalDataSourcesOauthAccountsRetrieveParams = {/*** The OAuth integration id whose accounts should be listed.@@ -71214,21 +71190,6 @@ export namespace Schemas {source_type: string;};- export type ExternalDataSourcesConnectionsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-export type ExternalDataSourcesOauthAccountsRetrieveParams = {/*** The OAuth integration id whose accounts should be listed.diff --git a/services/mcp/src/generated/warehouse_sources/api.ts b/services/mcp/src/generated/warehouse_sources/api.tsindex 90d9a5940976..fc965ed4c0da 100644--- a/services/mcp/src/generated/warehouse_sources/api.ts+++ b/services/mcp/src/generated/warehouse_sources/api.ts@@ -1681,12 +1681,6 @@ export const ExternalDataSourcesConnectionsListParams = /* @__PURE__ */ zod.obje),})-export const ExternalDataSourcesConnectionsListQueryParams = /* @__PURE__ */ zod.object({- limit: zod.number().optional().describe('Number of results to return per page.'),- offset: zod.number().optional().describe('The initial index from which to return the results.'),- search: zod.string().optional().describe('A search term.'),-})-/*** One-shot data warehouse source setup.*diff --git a/services/mcp/src/tools/generated/warehouse_sources.ts b/services/mcp/src/tools/generated/warehouse_sources.tsindex 01d235361e7a..cb405ccc7d38 100644--- a/services/mcp/src/tools/generated/warehouse_sources.ts+++ b/services/mcp/src/tools/generated/warehouse_sources.ts@@ -16,7 +16,6 @@ import {ExternalDataSchemasResyncCreateParams,ExternalDataSchemasRetrieveParams,ExternalDataSourcesConnectLinkRetrieveQueryParams,- ExternalDataSourcesConnectionsListQueryParams,ExternalDataSourcesCreateBody,ExternalDataSourcesCreateWebhookCreateBody,ExternalDataSourcesCreateWebhookCreateParams,@@ -438,24 +437,20 @@ const externalDataSourcesCheckCdcPrerequisitesCreate = (): ToolBase<},})-const ExternalDataSourcesConnectionsListSchema = ExternalDataSourcesConnectionsListQueryParams+const ExternalDataSourcesConnectionsListSchema = z.object({})const externalDataSourcesConnectionsList = (): ToolBase<typeof ExternalDataSourcesConnectionsListSchema,- WithPostHogUrl<Schemas.PaginatedExternalDataSourceConnectionOptionList>+ WithPostHogUrl<Schemas.ExternalDataSourceConnectionOption[]>> => ({name: 'external-data-sources-connections-list',schema: ExternalDataSourcesConnectionsListSchema,+ // eslint-disable-next-line no-unused-varshandler: async (context: Context, params: z.infer<typeof ExternalDataSourcesConnectionsListSchema>) => {const projectId = await context.stateManager.getProjectId()- const result = await context.api.request<Schemas.PaginatedExternalDataSourceConnectionOptionList>({+ const result = await context.api.request<Schemas.ExternalDataSourceConnectionOption[]>({method: 'GET',path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_sources/connections/`,- query: {- limit: params.limit,- offset: params.offset,- search: params.search,- },})return await withPostHogUrl(context, result, '/data-management/sources')},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-connections-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-connections-list.jsonindex bc560e594d69..7b7ea9186078 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-connections-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-connections-list.json@@ -1,18 +1,5 @@{"$schema": "https://json-schema.org/draft/2020-12/schema",- "properties": {- "limit": {- "description": "Number of results to return per page.",- "type": "number"- },- "offset": {- "description": "The initial index from which to return the results.",- "type": "number"- },- "search": {- "description": "A search term.",- "type": "string"- }- },+ "properties": {},"type": "object"}