Skip to content

Commit

Permalink
DH-4749 Set timezone for last_schema_sync field (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjc712 authored Oct 2, 2023
1 parent 79784de commit 52dd426
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dataherald/db_scanner/models/types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from datetime import datetime
from datetime import datetime, timezone
from enum import Enum
from typing import Any

from pydantic import BaseModel
from pydantic import BaseModel, validator


class ForeignKeyDetail(BaseModel):
Expand Down Expand Up @@ -39,3 +39,9 @@ class TableSchemaDetail(BaseModel):
last_schema_sync: datetime | None
status: str = TableDescriptionStatus.SYNCHRONIZED.value
error_message: str | None

@validator("last_schema_sync", pre=True)
def parse_datetime_with_timezone(cls, value):
if not value:
return None
return value.replace(tzinfo=timezone.utc) # Set the timezone to UTC

0 comments on commit 52dd426

Please sign in to comment.