Skip to content

Commit

Permalink
Fix bool coercion to 0/1 (#4512)
Browse files Browse the repository at this point in the history
* Fix bool coercion

* Fix unit test

automatic commit by git-black, original commits:
  417ccdc
  • Loading branch information
jtcohen6 authored and iknox-fa committed Feb 8, 2022
1 parent 8806773 commit 9c1369e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/dbt/clients/agate_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class Number(agate.data_types.Number):
# i.e. do not cast True and False to numeric 1 and 0
def cast(self, d):
if type(d) == bool:
raise agate.exceptions.CastError(
'Do not cast True to 1 or False to 0.'
)
raise agate.exceptions.CastError("Do not cast True to 1 or False to 0.")
else:
return super().cast(d)

Expand Down Expand Up @@ -53,7 +51,7 @@ def build_type_tester(
) -> agate.TypeTester:

types = [
Number(null_values=('null', '')),
Number(null_values=("null", "")),
agate.data_types.Date(null_values=('null', ''),
date_format='%Y-%m-%d'),
agate.data_types.DateTime(null_values=('null', ''),
Expand Down

0 comments on commit 9c1369e

Please sign in to comment.