A little testing confirms that the problem is bubbling up from below
SA. The equivalent statement run through pyodbc yields the same error.

Out of curiosity, I checked to see if Python types were converted as
expected in a different context.

for pytype in (1, 1.1, decimal.Decimal('1.1'), '1',
datetime.datetime.now(), True, None):
    cursor.execute("select cast(sql_variant_property(?, 'BaseType') as
varchar) as sqltype", pytype)
    print type(pytype), ' = ', cursor.fetchone().sqltype

No surprises there:
<type 'int'>  =  int
<type 'float'>  =  float
<class 'decimal.Decimal'>  =  numeric
<type 'str'>  =  varchar
<type 'datetime.datetime'>  =  datetime
<type 'bool'>  =  bit
<type 'NoneType'>  =  None

However, adding a unicode type to the test list gives us nice "[HY004]
[FreeTDS][SQL Server]Invalid data type (0) (SQLBindParameter)" error
message. Using +/- operators on datetimes also throws a type error.

Anyway, this is probably veering outside of the scope of an SQLAlchemy
group topic, but I'll try and find another (free) alternative to
FreeTDS and see how the same tests fare...

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