diff --git a/frontend/src/scenes/data-warehouse/external/SourceModal.tsx b/frontend/src/scenes/data-warehouse/external/SourceModal.tsx index 01e37ce384332..68ded8034f627 100644 --- a/frontend/src/scenes/data-warehouse/external/SourceModal.tsx +++ b/frontend/src/scenes/data-warehouse/external/SourceModal.tsx @@ -1,4 +1,4 @@ -import { LemonButton, LemonModal, LemonModalProps, Link } from '@posthog/lemon-ui' +import { LemonButton, LemonModal, LemonModalProps } from '@posthog/lemon-ui' import { useActions, useValues } from 'kea' import { FEATURE_FLAGS } from 'lib/constants' import { featureFlagLogic } from 'lib/logic/featureFlagLogic' @@ -79,26 +79,22 @@ function FirstStep(): JSX.Element { if (config.name === 'Stripe') { return ( - + stripe logo ) } if (config.name === 'Hubspot') { return ( -
- - - hubspot logo - - -
+ + hubspot logo + ) } if (config.name === 'Postgres' && featureFlags[FEATURE_FLAGS.DATA_WAREHOUSE_POSTGRES_IMPORT]) { return ( - + Postgres ) diff --git a/posthog/temporal/data_imports/external_data_job.py b/posthog/temporal/data_imports/external_data_job.py index 17be75e9ee444..b9a12ade6b236 100644 --- a/posthog/temporal/data_imports/external_data_job.py +++ b/posthog/temporal/data_imports/external_data_job.py @@ -205,7 +205,7 @@ async def run_external_data_job(inputs: ExternalDataJobInputs) -> None: user=user, password=password, database=database, - sslmode="prefer" if settings.TEST else "require", + sslmode="prefer" if settings.TEST or settings.DEBUG else "require", schema=schema, table_names=inputs.schemas, ) diff --git a/posthog/warehouse/api/external_data_source.py b/posthog/warehouse/api/external_data_source.py index d7d2deb1b9452..6078e9d8cd6da 100644 --- a/posthog/warehouse/api/external_data_source.py +++ b/posthog/warehouse/api/external_data_source.py @@ -232,7 +232,7 @@ def _handle_postgres_source(self, request: Request, *args: Any, **kwargs: Any) - schema = payload.get("schema") table_names = payload.get("schemas") - if self._validate_postgres_host(host, self.team_id): + if not self._validate_postgres_host(host, self.team_id): raise InternalPostgresError() new_source_model = ExternalDataSource.objects.create( @@ -322,7 +322,7 @@ def reload(self, request: Request, *args: Any, **kwargs: Any): def database_schema(self, request: Request, *arg: Any, **kwargs: Any): host = request.query_params.get("host") port = request.query_params.get("port") - database = request.query_params.get("database") + database = request.query_params.get("dbname") user = request.query_params.get("user") password = request.query_params.get("password") diff --git a/posthog/warehouse/api/test/test_external_data_source.py b/posthog/warehouse/api/test/test_external_data_source.py index 13f7f91e6d6d3..43bce4e965336 100644 --- a/posthog/warehouse/api/test/test_external_data_source.py +++ b/posthog/warehouse/api/test/test_external_data_source.py @@ -171,7 +171,7 @@ def test_internal_postgres(self, patch_get_postgres_schemas): data={ "host": "172.16.0.0", "port": int(settings.PG_PORT), - "database": settings.PG_DATABASE, + "dbname": settings.PG_DATABASE, "user": settings.PG_USER, "password": settings.PG_PASSWORD, "schema": "public", @@ -187,7 +187,7 @@ def test_internal_postgres(self, patch_get_postgres_schemas): data={ "host": "172.16.0.0", "port": int(settings.PG_PORT), - "database": settings.PG_DATABASE, + "dbname": settings.PG_DATABASE, "user": settings.PG_USER, "password": settings.PG_PASSWORD, "schema": "public", @@ -203,7 +203,7 @@ def test_internal_postgres(self, patch_get_postgres_schemas): data={ "host": "172.16.0.0", "port": int(settings.PG_PORT), - "database": settings.PG_DATABASE, + "dbname": settings.PG_DATABASE, "user": settings.PG_USER, "password": settings.PG_PASSWORD, "schema": "public", @@ -219,7 +219,7 @@ def test_internal_postgres(self, patch_get_postgres_schemas): data={ "host": "172.16.0.0", "port": int(settings.PG_PORT), - "database": settings.PG_DATABASE, + "dbname": settings.PG_DATABASE, "user": settings.PG_USER, "password": settings.PG_PASSWORD, "schema": "public", diff --git a/posthog/warehouse/models/external_data_schema.py b/posthog/warehouse/models/external_data_schema.py index fcef4ae7736ba..4f882ff97ed72 100644 --- a/posthog/warehouse/models/external_data_schema.py +++ b/posthog/warehouse/models/external_data_schema.py @@ -55,7 +55,7 @@ def get_postgres_schemas(host: str, port: str, database: str, user: str, passwor dbname=database, user=user, password=password, - sslmode="prefer" if settings.TEST else "require", + sslmode="prefer" if settings.TEST or settings.DEBUG else "require", ) with connection.cursor() as cursor: