Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions data_diff/databases/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ def constant_values(self, rows) -> str:
return f"VALUES {values}"

def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
# For timezone-aware columns (datetimeoffset), convert to UTC explicitly
# since MsSQL cannot set a session timezone.
# For timezone-naive columns (datetime/datetime2), no conversion is possible
# without knowing the source timezone — values are used as-is.
if isinstance(coltype, TimestampTZ):
value = f"{value} AT TIME ZONE 'UTC'"

if coltype.precision > 0:
formatted_value = (
f"FORMAT({value}, 'yyyy-MM-dd HH:mm:ss') + '.' + "
Expand Down
Loading