From b263ba7df2738e270ac470508a3453bd3d183540 Mon Sep 17 00:00:00 2001 From: Brian Hartsock Date: Tue, 18 Dec 2018 22:47:02 -0500 Subject: [PATCH] Ensure character columns are treated as string types. --- dbt/schema.py | 2 +- test/unit/test_schema.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dbt/schema.py b/dbt/schema.py index 3a34903a867..f4b75e7b6a1 100644 --- a/dbt/schema.py +++ b/dbt/schema.py @@ -45,7 +45,7 @@ def data_type(self): return self.dtype def is_string(self): - return self.dtype.lower() in ['text', 'character varying'] + return self.dtype.lower() in ['text', 'character varying', 'character'] def is_numeric(self): return self.dtype.lower() in ['numeric', 'number'] diff --git a/test/unit/test_schema.py b/test/unit/test_schema.py index a7c3d94fff0..6c065a422d7 100644 --- a/test/unit/test_schema.py +++ b/test/unit/test_schema.py @@ -2,6 +2,17 @@ import dbt.schema +class TestStringType(unittest.TestCase): + + def test__character_type(self): + col = dbt.schema.Column( + 'fieldname', + 'character', + char_size=10 + ) + + self.assertEqual(col.data_type, 'character varying(10)') + class TestNumericType(unittest.TestCase):