-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On May 17, 2012, at 7:15 AM, Adam Tauno Williams wrote: > On Tue, 2012-05-15 at 20:32 -0400, Adam Tauno Williams wrote: >> On Tue, 2012-05-15 at 19:51 -0400, Adam Tauno Williams wrote: >>> On Tue, 2012-05-15 at 16:27 -0400, Michael Bayer wrote: >>>> Could be tough, you'd need to test it against the informix dbapi directly, >>> using bound parameters, to see what it needs. Could be a typing issue. >>> Ok, I got a response from an Informix guru and maintainer of the >>> informix dbapi. >>> <quote> >>> I see two different approaches around this issue: >>> * Use literal values instead of bound parameters in the projection >>> clause. >>> * If you must use bound parameters, use type casts for the parameters >>> that are used in the projection clause. For example: CASE WHEN >>> (xrefr.xr_supersede = :1) THEN :2::int ELSE :3::int >>> </quote> >>> I assume this same kind of issue must be addressed in other dialects??? >> I've constructed a sequence that seems to work perfectly. > > For anyone in the future [list archives & search engines] trying to use > the Informix dialect I've posted a BLOG post about this issue: > <http://www.whitemiceconsulting.com/2012/05/informix-dialect-with-case-derived.html> thanks for this. im amazed the informix dialect even works, actually, I've never tested it personally.... > >> class XrefrRecord(Base): >> >> __tablename__ = 'xrefr' >> record_id = Column("xr_serial_no", Integer, primary_key=True) >> sku = Column("xr_stock_no", Integer, nullable=False) >> .... >> list_price = Column("xr_list_price", Float(precision=3)) >> _supersede = Column("xr_supersede", String(1)) >> is_supersede = column_property( >> case( [ ( _supersede == 'S', >> literal_column('1', Integer) ) ], >> else_ = literal_column('0', Integer) >> ) >> ) >> >> __mapper_args__ = { 'polymorphic_on': is_supersede } >> >> >> class Cross(XrefrRecord): >> __mapper_args__ = {'polymorphic_identity': 0} >> >> >> class Supersede(XrefrRecord): >> __mapper_args__ = {'polymorphic_identity': > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJPtPaOAAoJEDMCOcHE2v7hQn4H/3Tug16dDLFgk035GG5QNVNz PkdRmwKr7lH6kMIAWuHtIlsakfJKxjl7dt/e07wDfo2PNwsx6Symq/u+fkDX2k6g Oo+t53obW9bUA3lXmxkArX7x9xtsN8eB1Vevq+xpQmwKVJuIpViY4yq21fpNFBk1 tyfOWIEgLs+mJ635EGq+OZX8TByYfxSW8WtEtoLbRXpM6KO/31CbNUCew62MFtB1 Al/dtKU7C/2QZXTu7scxp4FpmI8+22AVXOQDF9fGLvtbR1ja01ftOnmI247vwSCG Z0gm0b7isGFO1Meo+9JipaHjy0YZaVNu1yVuDHja6bwZD5T+dDrgVR/etpB6pmw= =CDzi -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.