Skip to content

Commit 6201dbb

Browse files
authored
Merge pull request #4 from sede-open/feature/numeric-to-include-precision-scale
numeric type fix to create with precision
2 parents d34a7f9 + 99122ec commit 6201dbb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/databricks/sqlalchemy/dialect/compiler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def visit_INTEGER(self, type_):
88
return "INT"
99

1010
def visit_NUMERIC(self, type_):
11-
return "DECIMAL"
11+
if type_.precision is None:
12+
return "DECIMAL"
13+
elif type_.scale is None:
14+
return "DECIMAL({precision})".format(precision=type_.precision)
15+
else:
16+
return "DECIMAL({precision}, {scale})".format(precision=type_.precision, scale=type_.scale)
1217

1318
def visit_CHAR(self, type_):
1419
return "STRING"

0 commit comments

Comments
 (0)