diff --git a/posthog/warehouse/api/external_data_schema.py b/posthog/warehouse/api/external_data_schema.py index 35669885f66..dff4252b34a 100644 --- a/posthog/warehouse/api/external_data_schema.py +++ b/posthog/warehouse/api/external_data_schema.py @@ -317,17 +317,12 @@ class ExternalDataSchemaViewset(TeamAndOrgViewSetMixin, viewsets.ModelViewSet): ] else: mapping = PIPELINE_TYPE_INCREMENTAL_FIELDS_MAPPING.get(source.source_type) - if not mapping: + if mapping is None: return Response( status=status.HTTP_400_BAD_REQUEST, data={"message": f'Source type "{source.source_type}" not found'}, ) - mapping_fields = mapping.get(instance.name) - if not mapping_fields: - return Response( - status=status.HTTP_400_BAD_REQUEST, - data={"message": f'Incremental fields for "{source.source_type}.{instance.name}" can\'t be found'}, - ) + mapping_fields = mapping.get(instance.name, []) incremental_columns = mapping_fields diff --git a/posthog/warehouse/api/test/test_external_data_schema.py b/posthog/warehouse/api/test/test_external_data_schema.py index 4babec0833a..e248204d880 100644 --- a/posthog/warehouse/api/test/test_external_data_schema.py +++ b/posthog/warehouse/api/test/test_external_data_schema.py @@ -106,7 +106,9 @@ class TestExternalDataSchema(APIBaseTest): f"/api/projects/{self.team.pk}/external_data_schemas/{schema.id}/incremental_fields", ) - assert response.status_code == 400 + # should respond but with empty list. Example: Hubspot has not incremental fields but the response should be an empty list so that full refresh is selectable + assert response.status_code == 200 + assert response.json() == [] @pytest.mark.django_db(transaction=True) @pytest.mark.asyncio