Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure character columns are treated as string types. #1191

Merged
merged 1 commit into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dbt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
11 changes: 11 additions & 0 deletions test/unit/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down