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.

Sent from my iPhone

On May 15, 2012, at 11:36 AM, Adam Tauno Williams <awill...@whitemice.org> 
wrote:

> I'm use the Informix dialog with SQLalchemy 0.7.7 (the latest 0.7.x
> release).
> 
> It works.
> 
> But now I'm getting this error -
> 
> sqlalchemy.exc.ProgrammingError: (ProgrammingError) SQLCODE -201 in
> PREPARE: 
> 42000: Syntax error or access violation
> 'SELECT xrefr.xr_serial_no AS xrefr_xr_serial_no, xrefr.xr_stock_no AS
> xrefr_xr_stock_no, xrefr.xr_desc AS xrefr_xr_desc, xrefr.xr_oem_code AS
> xrefr_xr_oem_code, xrefr.xr_oem_partcode AS xrefr_xr_oem_partcode,
> xrefr.xr_vend_code AS xrefr_xr_vend_code, xrefr.xr_vendr_part_code AS
> xrefr_xr_vendr_part_code, xrefr.xr_vendr_stock_no AS
> xrefr_xr_vendr_stock_no, xrefr.xr_min_qty AS xrefr_xr_min_qty,
> xrefr.xr_weight AS xrefr_xr_weight, xrefr.xr_quality_code AS
> xrefr_xr_quality_code, xrefr.xr_net_price AS xrefr_xr_net_price,
> xrefr.xr_list_price AS xrefr_xr_list_price, xrefr.xr_supersede AS
> xrefr_xr_supersede, CASE WHEN (xrefr.xr_supersede = :1) THEN :2 ELSE :3
> END AS anon_1 \nFROM xrefr \nWHERE xrefr.xr_oem_code = :4 AND
> xrefr.xr_vend_code = :5 AND CASE WHEN (xrefr.xr_supersede = :6) THEN :7
> ELSE :8 END IN (:9)' ('S', 1, 0, '35X', 'A78', 'S', 1, 0, 0)
> 
> Only issue is that this is a *legitimate* statement.  If I cut-n-paste
> this into a query tool [like DbVisualizer] this statement runs without
> issue.  Any tips or suggestions on how to determine what is actually
> wrong?
> 
> 
> 
> SELECT xrefr.xr_serial_no AS xrefr_xr_serial_no, 
>       xrefr.xr_stock_no AS xrefr_xr_stock_no, 
>       xrefr.xr_desc AS xrefr_xr_desc, 
>       xrefr.xr_oem_code AS xrefr_xr_oem_code, 
>       xrefr.xr_oem_partcode AS xrefr_xr_oem_partcode, 
>       xrefr.xr_vend_code AS xrefr_xr_vend_code, 
>       xrefr.xr_vendr_part_code AS xrefr_xr_vendr_part_code, 
>       xrefr.xr_vendr_stock_no AS xrefr_xr_vendr_stock_no, 
>       xrefr.xr_min_qty AS xrefr_xr_min_qty, 
>       xrefr.xr_weight AS xrefr_xr_weight, 
>       xrefr.xr_quality_code AS xrefr_xr_quality_code, 
>       xrefr.xr_net_price AS xrefr_xr_net_price, 
>       xrefr.xr_list_price AS xrefr_xr_list_price, 
>       xrefr.xr_supersede AS xrefr_xr_supersede, 
>       CASE WHEN (xrefr.xr_supersede = 'S') THEN 1 ELSE 0 END AS anon_1 
> FROM xrefr 
> WHERE xrefr.xr_oem_code = '35X' 
>  AND xrefr.xr_vend_code = 'A78'
> AND CASE WHEN (xrefr.xr_supersede = 'S') THEN 1 ELSE 0 END IN (0)
> 
> 
> 
> class XrefrRecord(Base):
>    __tablename__        = 'xrefr'
>    record_id            = Column("xr_serial_no", Integer,
> primary_key=True)
>    sku                  = Column("xr_stock_no", Integer,
> nullable=False)
>    description          = Column("xr_desc", String(30))
>    oem_code             = Column("xr_oem_code", String(4),
> ForeignKey('oemr.oe_oem_code'))
>    native_form          = Column("xr_oem_partcode", String(20),
> nullable=False)
>    vendor_code          = Column("xr_vend_code", String(4),
> ForeignKey('vendorr.ve_vend_code'))
>    vendor_part_code     = Column("xr_vendr_part_code", String(24),
> nullable=False)
>    vendor_stock_code    = Column("xr_vendr_stock_no", String(20),
> nullable=False)
>    minimum_quantity     = Column("xr_min_qty", Integer)
>    weight               = Column("xr_weight", Integer)
>    quality_code         = Column("xr_quality_code", String(1),
> default='U')
>    net_price            = Column("xr_net_price",
> Float(precision=3))    
>    list_price           = Column("xr_list_price", Float(precision=3))
>    _supersede           = Column("xr_supersede", String(1))
>    is_supersede         = column_property( case( [ ( _supersede == 'S',
> 1, ), ],
>                                                    else_ = 0 ) )
> 
>    __mapper_args__     = { 'polymorphic_on': is_supersede }
> 
>    oem = relation( 'OEM', uselist = False, primaryjoin =
> ( 'OEM.code==Cross.oem_code' ) )
>    vendor = relation( 'Vendor', uselist = False, primaryjoin =
> ( 'Vendor.code==Cross.vendor_code' ) )                
> 
> 
> class Cross(XrefrRecord):  
>    __mapper_args__ = {'polymorphic_identity': 0}  
> 
>    def __repr__(self):
>        return '<Cross record_id="{0}"
> SKU="{1}"/>'.format(self.record_id, self.sku)
> 
> class Supsersede(XrefrRecord):  
>    __mapper_args__ = {'polymorphic_identity': 1}  
> 
>    def __repr__(self):
>        return '<Cross record_id="{0}"
> SKU="{1}"/>'.format(self.record_id, self.sku)

-- 
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.

Reply via email to