summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/oracle/base.py
diff options
context:
space:
mode:
authorKent Bower <kb@retailarchitects.com>2018-04-11 17:21:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-04-12 18:41:59 -0400
commita3473c08d35e2cce32b014519df5f774c0166cf1 (patch)
treea230e8a4e42ad189a7f2d331f8ce3ebf9db2a359 /lib/sqlalchemy/dialects/oracle/base.py
parent2cbaebe6c52c9b8df98d108464029162694db8ac (diff)
downloadsqlalchemy-a3473c08d35e2cce32b014519df5f774c0166cf1.tar.gz
Reflect Oracle NUMBER(NULL, 0) as INTEGER
The Oracle NUMBER datatype is reflected as INTEGER if the precision is NULL and the scale is zero, as this is how INTEGER values come back when reflected from Oracle's tables. Pull request courtesy Kent Bower. Change-Id: I4627febd46cab7085299c0a5700ee0f0bdca513c Pull-request: https://github.com/zzzeek/sqlalchemy/pull/437
Diffstat (limited to 'lib/sqlalchemy/dialects/oracle/base.py')
-rw-r--r--lib/sqlalchemy/dialects/oracle/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py
index 44ab9e3bb..e55a9cbc6 100644
--- a/lib/sqlalchemy/dialects/oracle/base.py
+++ b/lib/sqlalchemy/dialects/oracle/base.py
@@ -354,7 +354,7 @@ from sqlalchemy.sql import operators as sql_operators
from sqlalchemy.sql.elements import quoted_name
from sqlalchemy import types as sqltypes, schema as sa_schema
from sqlalchemy.types import VARCHAR, NVARCHAR, CHAR, \
- BLOB, CLOB, TIMESTAMP, FLOAT
+ BLOB, CLOB, TIMESTAMP, FLOAT, INTEGER
from itertools import groupby
RESERVED_WORDS = \
@@ -1414,7 +1414,10 @@ class OracleDialect(default.DefaultDialect):
comment = row[7]
if coltype == 'NUMBER':
- coltype = NUMBER(precision, scale)
+ if precision is None and scale == 0:
+ coltype = INTEGER()
+ else:
+ coltype = NUMBER(precision, scale)
elif coltype in ('VARCHAR2', 'NVARCHAR2', 'CHAR'):
coltype = self.ischema_names.get(coltype)(length)
elif 'WITH TIME ZONE' in coltype: