Subject Re: [firebird-python] fdb 1.4.3, SA 0.9.7 on Py2.7 conversion error
Author Werner
Hi,
On 2/3/2015 17:13, Werner wernerfbd@... [firebird-python] wrote:
 

Hi,

I am getting the following error during testing of my application, but
only on Py2.7, if I run the same application on Py3.4 with the same fdb
and SQLAlchemy version I don't see this error.

I'll continue to search for the reason but if someone has a tip, please
let me know.

OK, I found the actual culprit and fixed it in my code, but maybe fdb can be improved.

The code causing it is:
s = """
SELECT cellarbook.id AS cellarbook_id, cellarbook.maturityfirst AS cellarbook_maturityfirst, cellarbook.maturitybest AS cellarbook_maturitybest, cellarbook.maturitypast AS cellarbook_maturitypast, cellarbook.storagelocation AS cellarbook_storagelocation, cellarbook.lastpurchaseprice AS cellarbook_lastpurchaseprice, cellarbook.avgpurchaseprice AS cellarbook_avgpurchaseprice, cellarbook.currentvalue AS cellarbook_currentvalue, cellarbook.quantitypurchased AS cellarbook_quantitypurchased, cellarbook.quantityconsumed AS cellarbook_quantityconsumed, cellarbook.quantityonhand AS cellarbook_quantityonhand, cellarbook.purchasevalueonhand AS cellarbook_purchasevalueonhand, cellarbook.currentvalueonhand AS cellarbook_currentvalueonhand, cellarbook.isactive AS cellarbook_isactive, cellarbook.printlabel AS cellarbook_printlabel, cellarbook.minqoh AS cellarbook_minqoh, cellarbook.avgscore AS cellarbook_avgscore, cellarbook.avgscore2 AS cellarbook_avgscore2, cellarbook.maxprice AS cellarbook_maxprice, cellarbook.purchaseagain AS cellarbook_purchaseagain, cellarbook.uservint1 AS cellarbook_uservint1, cellarbook.uservint2 AS cellarbook_uservint2, cellarbook.userbot1 AS cellarbook_userbot1, cellarbook.userbot2 AS cellarbook_userbot2, cellarbook.fk_supplier_id AS cellarbook_fk_supplier_id, cellarbook.fk_cellar_id AS cellarbook_fk_cellar_id, cellarbook.fk_authuser_id AS cellarbook_fk_authuser_id, cellarbook.fk_bottle_id AS cellarbook_fk_bottle_id, cellarbook.fk_vintage_id AS cellarbook_fk_vintage_id, cellarbook.fk_drinkinfo_id AS cellarbook_fk_drinkinfo_id, cellarbook.created_at AS cellarbook_created_at, cellarbook.updated_at AS cellarbook_updated_at, cellarbook.created_by AS cellarbook_created_by, cellarbook.updated_by AS cellarbook_updated_by
FROM cellarbook
WHERE cellarbook.fk_authuser_id = :fk_authuser_id_1 AND cellarbook.maturityfirst BETWEEN :maturityfirst_1 AND :maturityfirst_2
"""

s = db.sasql.text(s)

result = session.connection().execute(s, fk_authuser_id_1=1, maturityfirst_1='', maturityfirst_2='')

for i in result:
    print(i)

The two "maturityfirst" are integer columns and I inadvertently used a string for the filter value.

It would be nice if fdb could get a more detailed error to make it easier to track down such an error.

Werner