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

Commit 1d7dc0c

Browse files
committed
Fix booleans for databricks
1 parent afa2326 commit 1d7dc0c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

data_diff/sqeleton/databases/databricks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DbPath,
1414
ColType,
1515
UnknownColType,
16+
Boolean
1617
)
1718
from ..abcs.mixins import AbstractMixin_MD5, AbstractMixin_NormalizeValue
1819
from .base import MD5_HEXDIGITS, CHECKSUM_HEXDIGITS, BaseDialect, ThreadedDatabase, import_helper, parse_table_name
@@ -47,6 +48,9 @@ def normalize_number(self, value: str, coltype: NumericType) -> str:
4748
value = f"format_number({value}, {coltype.precision})"
4849
return f"replace({self.to_string(value)}, ',', '')"
4950

51+
def normalize_boolean(self, value: str, coltype: Boolean) -> str:
52+
return self.to_string(f"cast ({value} as int)")
53+
5054

5155
class Dialect(BaseDialect):
5256
name = "Databricks"
@@ -64,6 +68,8 @@ class Dialect(BaseDialect):
6468
"TIMESTAMP": Timestamp,
6569
# Text
6670
"STRING": Text,
71+
# Boolean
72+
"BOOLEAN": Boolean,
6773
}
6874

6975
def quote(self, s: str):

0 commit comments

Comments
 (0)