Problem autoloading Oracle tables with float or double precision columns

Issue #366 resolved
Former user created an issue

The following exception results when trying to autoload a table with floating-point columns with Oracle:

>>> import sqlalchemy as sql
>>> eng = sql.create_engine( 'oracle://scott:tiger@SID', auto_setinputsizes=True )
>>> eng.execute( 'create table foo( bar double precision )' )
>>> md = BoundMetaData( eng )
>>> tbl = sql.Table( 'foo', md, autoload=True )
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "sqlalchemy/schema.py", line 143, in __call__
    metadata.get_engine().reflecttable(table)
  File "sqlalchemy/engine/base.py", line 505, in reflecttable
    self.dialect.reflecttable(conn, table)
  File "sqlalchemy/databases/oracle.py", line 253, in reflecttable
    raise exceptions.AssertionError("Cant get coltype for type '%s'" % coltype)
sqlalchemy.exceptions.AssertionError: Cant get coltype for type 'FLOAT'

Comments (4)

  1. Former user Account Deleted

    This patch to appears to fix the problem:

    Index: sqlalchemy/databases/oracle.py
    ===================================================================
    --- sqlalchemy/databases/oracle.py      (revision 2102)
    +++ sqlalchemy/databases/oracle.py      (working copy)
    @@ -97,7 +97,9 @@
         'NUMBER' : OracleNumeric,
         'BLOB' : OracleBinary,
         'CLOB' : OracleText,
    -    'TIMESTAMP' : OracleTimestamp
    +    'TIMESTAMP' : OracleTimestamp,
    +    'FLOAT' : OracleNumeric,
    +    'DOUBLE PRECISION' : OracleNumeric,
     }
    
     constraintSQL = """SELECT
    
  2. Log in to comment