Skip to content

Commit

Permalink
fix(data-warehouse): Set the correct schema error status (#23413)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Gilbert09 and github-actions[bot] authored Jul 3, 2024
1 parent a1c2038 commit f1a60c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ posthog/hogql_queries/web_analytics/top_clicks.py:0: error: Module "django.utils
posthog/api/user.py:0: error: "User" has no attribute "social_auth" [attr-defined]
ee/api/test/base.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "License") [assignment]
ee/api/test/base.py:0: error: "setUpTestData" undefined in superclass [misc]
posthog/warehouse/external_data_source/jobs.py:0: error: Incompatible types in assignment (expression has type "str", variable has type "Status") [assignment]
posthog/warehouse/external_data_source/jobs.py:0: error: Incompatible type for lookup 'id': (got "UUID | None", expected "UUID | str") [misc]
posthog/test/test_utils.py:0: error: Argument 5 to "post" of "_RequestFactory" has incompatible type "**dict[str, str]"; expected "Mapping[str, Any] | None" [arg-type]
posthog/test/test_plugin_log_entry.py:0: error: Module "django.utils.timezone" does not explicitly export attribute "datetime" [attr-defined]
Expand Down
7 changes: 6 additions & 1 deletion posthog/warehouse/external_data_source/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ def update_external_job_status(run_id: UUID, team_id: int, status: str, latest_e
model.latest_error = latest_error
model.save()

if status == ExternalDataJob.Status.FAILED:
schema_status = ExternalDataSchema.Status.ERROR
else:
schema_status = status

schema = ExternalDataSchema.objects.get(id=model.schema_id, team_id=team_id)
schema.status = status
schema.status = schema_status
schema.save()

model.refresh_from_db()
Expand Down

0 comments on commit f1a60c7

Please sign in to comment.