diff options
| author | Derek Harland <derek.harland@finq.co.nz> | 2012-12-04 14:24:59 +1300 |
|---|---|---|
| committer | Derek Harland <derek.harland@finq.co.nz> | 2012-12-04 14:24:59 +1300 |
| commit | a10b60bbb9986ea9db8ac235de932c087b94fda1 (patch) | |
| tree | 41a222efc3404a1899a54196e2292f6fcb56d3ef /lib/sqlalchemy/sql/compiler.py | |
| parent | ab7103b7b5d8d7f3f1b21970f368c8c60eca595b (diff) | |
| parent | 850fb33094549849d48f5f181793aa9474c14e2d (diff) | |
| download | sqlalchemy-a10b60bbb9986ea9db8ac235de932c087b94fda1.tar.gz | |
Merge changes from official sqlalchemy repo
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 102b44a7e..215ecf7bd 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2084,7 +2084,15 @@ class GenericTypeCompiler(engine.TypeCompiler): 'scale': type_.scale} def visit_DECIMAL(self, type_): - return "DECIMAL" + if type_.precision is None: + return "DECIMAL" + elif type_.scale is None: + return "DECIMAL(%(precision)s)" % \ + {'precision': type_.precision} + else: + return "DECIMAL(%(precision)s, %(scale)s)" % \ + {'precision': type_.precision, + 'scale': type_.scale} def visit_INTEGER(self, type_): return "INTEGER" |
