Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`discover` was returning a bytes dtype for the `sa.TIMESTAMP` instead of `datetime_`. That bug was because the SQLAlchemy dialect for MSSQL currently directly imports `sa.TIMESTAMP`, causing a collision in `odo.backends.sql.revtypes`. Fix by 1) creating a subclass of `mssql.TIMESTAMP` to use as the key in `revtypes` so that it does not overwrite `sa.TIMESTAMP` 2) assign that subclass to the mssql dialect's `'TIMESTAMP'` (using `ischema_names`), so that the subclass will be returned by the type engine instead of `mssql.TIMESTAMP`. The added test for the (`sa.TIMESTAMP`, `datetime_`) without the fix applied would result in this error: ``` a = Bytes(), b = DateTime(tz=None), path = ('.measure', "['ts']", '.ty') kwargs = {'check_dim': True, 'check_record_order': True} @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: bytes != datetime E path: _.measure['value'].ty ``` This patch includes checks for the other types besides `sa.TIMESTAMP` for better protection against the general case of failures when using `revtypes` to map SQLAlchemy types to dtypes. Those extra cases exposed an issue with `sa.Float(precision=24)`. That case is commented out to keep the fix of this patch on the `sa.TIMESTAMP` mapping. (I would have used `pytest.param` to mark it xfail, but pytest for this project needs to be upgraded first.) See: blaze#567 blaze#568 https://bitbucket.org/zzzeek/sqlalchemy/issues/4092/type-problem-with-mssqltimestamp blaze/blaze#1656
- Loading branch information