0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

fix(data-warehouse): return empty incremental field list (#23287)

* return empty and not an error

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Eric Duong 2024-06-27 16:03:07 -04:00 committed by GitHub
parent d9e7f04879
commit 56e7a4c469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -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