[Sqlalchemy-tickets] Issue #4265: support oracle floating point binary precision (zzzeek/sqlalchemy
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2018-05-24 15:24:31
|
New issue 4265: support oracle floating point binary precision https://bitbucket.org/zzzeek/sqlalchemy/issues/4265/support-oracle-floating-point-binary Michael Bayer: the Float type supports "precision", however this is taken to mean decimal precision. Oracle's FLOAT supports a binary precision argument which is totally a different thing: http://www.exploringbinary.com/decimal-precision-of-binary-floating-point-numbers/. We'd like to support oracle.FLOAT(binary_precision=X) and potentially support conversion of Float(precision) to binary precision, if possible. ``` #!diff @@ -585,6 +566,9 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler): def visit_BINARY_FLOAT(self, type_, **kw): return self._generate_numeric(type_, "BINARY_FLOAT", **kw) + def visit_FLOAT(self, type_, **kw): + return self._generate_numeric(type_, "FLOAT", **kw) + def visit_NUMBER(self, type_, **kw): return self._generate_numeric(type_, "NUMBER", **kw) @@ -1418,6 +1402,11 @@ class OracleDialect(default.DefaultDialect): coltype = INTEGER() else: coltype = NUMBER(precision, scale) + elif coltype == 'FLOAT': + if precision is None: + coltype = FLOAT() + else: + coltype = FLOAT(precision) elif coltype in ('VARCHAR2', 'NVARCHAR2', 'CHAR'): coltype = self.ischema_names.get(coltype)(length) elif 'WITH TIME ZONE' in coltype: ``` |