test Informix dialect against an actual Informix database

Issue #1650 resolved
Former user created an issue

This is a follow on ticket to #1645.

The informix visit_clauselist() implementation seems to be broken:

411    def visit_clauselist(self, list, **kwargs):
412        return ', '.join([for s in [self.process(c) for c in list.clauses](s) if s is not None])

As far as I can tell, this causes WHERE clause elements to get joined together with commas rather than AND. Simply removing this method from InfoCompiler allows me to construct valid queries using the sql expression language.

Also, I noticed that constructing tables using e.g. sqlalchemy.Column('x', sqlalchemy.types.Float) results in a CREATE TABLE statement with column x of type NUMERIC(10,2): I was expecting a FLOAT column that wouldn't suffer from loss of precision due to rounding.

Attached is a patch against 0.5.7 that adds InfoFloat (mapped to sqlalchemy.types.Float) and InfoSmallFloat (for reflecting Informix tables containing SMALLFLOAT columns) column types, and removes visit_clauselist() from InfoCompiler.

Informix FLOAT/InfoFloat supports a precision argument; the database expects it to be between 1 and 14. It's not clear to me exactly what it it specifies and in any case is ignored by the database server - an IEEE 754 double is stored regardless. It's also not clear from the sqlalchemy documentation whether there is some cross-database interpretation of precision that I should be mapping to a database specific precision (MySQL seems to interpret the precision passed to FLOAT as the desired number of mantissa bits). Since I wasn't sure what to do about this, the patch just passes the user specified precision to Informix with no modifications.

For reference, here are links to the Informix IDS 11.50 documentation for built-in data types.

Comments (6)

  1. Mike Bayer repo owner

    two things -

    • can you send me your email address?
    • If I port the major aspects of informix into 0.6, can you shift your work from the 0.5 to the 0.6 series ? 0.6 will be released at least in beta format by Pycon and hopefully within january. Particularly with regards to datatypes the effort is mostly wasted in 0.5 as the approach has been updated in 0.6
  2. Former user Account Deleted

    I'd be more than happy to switch to 0.6 - you can reach me at smm [at](at) ipac {dot} caltech <period> edu

  3. Mike Bayer repo owner

    the latest trunk has an updated informix dialect, not tested, but includes most of the changes we've talked about. the NUMERIC/FLOAT distinction goes into the InfoTypeCompiler.

  4. Log in to comment