blaze / odo

Data Migration for the Blaze Project
http://odo.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1k stars 138 forks source link

BUG: Fix reflection Postgres double precision columns. #592

Closed ehebert closed 7 years ago

ehebert commented 7 years ago

A double precision column in a Postrges table, whose dshape specified a dtype of float64 for that column, would return a decimal dtype.

Fix by defining a group of types which are 'precision' types, and check for membership in that before attempting to lookup the typeengine typ in blaze.backends.sql.revtypes

Without the fix applied the newly added test fails with the following assertion error, when comparing the discover of the bind with the expected values:

    @assert_dshape_equal.register(object, object)
    def _base_case(a, b, path=None, **kwargs):
>       assert a == b, '%s != %s\n%s' % (a, b, _fmt_path(path))
E       AssertionError: decimal[precision=53, scale=None] != float64
E       path: _.measure['a']

Also, added sa.Float as a precision type, which fixes sa.Float(precision=24); this allows removal of the xfail marking in odo/backends/test/test_sql::test_types.

llllllllll commented 7 years ago

Thanks for this!