-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Problem description
When using pd.read_sql_table() with Oracle DB precision of data type sqlalchemy.dialects.oracle.NUMBER is lost.
Expected Output
Precision should not be lost as this datatype can be either integer or float.
The problem
Looks like the root cause for this is in _harmonize_columns(), particularly in _get_dtype() that is used there. The SQLAlchemy type sqlalchemy.dialects.oracle.NUMBER is based on both sqlalchemy.types.Numeric and sqlalchemy.types.Integer. As there is no support for SQLAlchemy Numeric type in _get_dtype() this Oracle type is being treated as integer and precision is dropped when using astype() in _harmonize_columns() itself.