Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 65be7c6

Browse files
committed
Fix databricks date
1 parent 54d6f2c commit 65be7c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

data_diff/databases/databricks.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ def md5_as_hex(self, s: str) -> str:
9292

9393
def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
9494
"""Databricks timestamp contains no more than 6 digits in precision"""
95-
95+
try:
96+
is_date = coltype.is_date
97+
except:
98+
is_date = False
99+
if isinstance(coltype, Date) or is_date:
100+
return f"date_format({value}, 'yyyy-MM-dd')"
96101
if coltype.rounds:
97102
# cast to timestamp due to unix_micros() requiring timestamp
98103
timestamp = f"cast(round(unix_micros(cast({value} as timestamp)) / 1000000, {coltype.precision}) * 1000000 as bigint)"

0 commit comments

Comments
 (0)