summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-03-06 09:05:23 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-03-06 09:06:04 -0500
commit2a2011389ab0d3c80cac175b8e35a18413641358 (patch)
tree3a428503ef481df5e071efbedd466061c4eaa70d /lib/sqlalchemy
parent201c4a60e4b8af56d9c02a3675d1443ba4171c89 (diff)
downloadsqlalchemy-2a2011389ab0d3c80cac175b8e35a18413641358.tar.gz
Ensure scale param not sent to float types
Fixed regression in SQL Server reflection due to :ticket:`4393` where the removal of open-ended ``**kw`` from the :class:`.Float` datatype caused reflection of this type to fail due to a "scale" argument being passed. Fixes: #4525 Change-Id: Ief8bb535778055eff2ab0d71660f81e3676390a1
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 494101140..2d883309d 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -876,8 +876,10 @@ class REAL(sqltypes.REAL):
__visit_name__ = "REAL"
def __init__(self, **kw):
- # REAL is a synonym for FLOAT(24) on SQL server
- kw["precision"] = 24
+ # REAL is a synonym for FLOAT(24) on SQL server.
+ # it is only accepted as the word "REAL" in DDL, the numeric
+ # precision value is not allowed to be present
+ kw.setdefault("precision", 24)
super(REAL, self).__init__(**kw)
@@ -2523,13 +2525,12 @@ class MSDialect(default.DefaultDialect):
)
coltype = sqltypes.NULLTYPE
else:
- if (
- issubclass(coltype, sqltypes.Numeric)
- and coltype is not MSReal
- ):
- kwargs["scale"] = numericscale
+ if issubclass(coltype, sqltypes.Numeric):
kwargs["precision"] = numericprec
+ if not issubclass(coltype, sqltypes.Float):
+ kwargs["scale"] = numericscale
+
coltype = coltype(**kwargs)
cdict = {
"name": name,