Skip to content

Commit 6254484

Browse files
committed
Added char_length_unit in OracleColumn.data_type to address #190
1 parent 9d8ff05 commit 6254484

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dbt/adapters/oracle/column.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ class OracleColumn(Column):
4040
@property
4141
def data_type(self) -> str:
4242
if self.is_string():
43-
return self.oracle_string_type(self.dtype, self.string_size())
43+
return self.oracle_string_type(self.dtype, self.string_size(), self.char_length_unit)
4444
elif self.is_numeric():
4545
return self.numeric_type(self.dtype, self.numeric_precision, self.numeric_scale)
4646
else:
4747
return self.dtype
4848

4949
@classmethod
50-
def oracle_string_type(cls, dtype: str, size: int = None):
50+
def oracle_string_type(cls, dtype: str, size: int = None,
51+
char_length_unit: str = None):
5152
"""
5253
- CHAR(SIZE)
5354
- VARCHAR2(SIZE)
@@ -56,6 +57,8 @@ def oracle_string_type(cls, dtype: str, size: int = None):
5657
"""
5758
if size is None:
5859
return dtype
60+
elif char_length_unit and char_length_unit.upper() == 'C':
61+
return "{}({} CHAR)".format(dtype, size)
5962
else:
6063
return "{}({})".format(dtype, size)
6164

0 commit comments

Comments
 (0)