what a coincidence, 2 days ago we stepped on this bindparam-types
thing; table.some_decimal_column == decimal.Decimal(5) did not always
work.
now it mostly works, i think there is one more case that breaks for
me: when the column itself is hidden in a function.
e.g.
table_A = Table( 'Nalichnost', meta,
Column( 'db_id', primary_key= True, type_= Integer, ),
Column( 'price', Numeric(precision=10,length=2,asdecimal=True), ),
)
print session.query( A).filter(
(func.coalesce( A.price, 0) ==Decimal( 1))
).all()
Traceback (most recent call last):
File "aa.py", line 40, in <module>
(func.coalesce( Nalichnost.cena, 0) ==Decimal( 1))
File "sqlalchemy/orm/query.py", line 586, in all
return list(self)
File "sqlalchemy/orm/query.py", line 634, in __iter__
return self._execute_and_instances(context)
File "sqlalchemy/orm/query.py", line 637, in _execute_and_instances
result = self.session.execute(querycontext.statement,
params=self._params, mapper=self.mapper)
File "sqlalchemy/orm/session.py", line 527, in execute
return self.__connection(engine,
close_with_result=True).execute(clause, params or {}, **kwargs)
File "sqlalchemy/engine/base.py", line 784, in execute
return Connection.executors[c](self, object, multiparams, params)
File "sqlalchemy/engine/base.py", line 835, in execute_clauseelement
return self._execute_compiled(elem.compile(dialect=self.dialect,
column_keys=keys, inline=len(params) > 1), distilled_params=params)
File "sqlalchemy/engine/base.py", line 847, in _execute_compiled
self.__execute_raw(context)
File "sqlalchemy/engine/base.py", line 859, in __execute_raw
self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
File "sqlalchemy/engine/base.py", line 875, in _cursor_execute
raise exceptions.DBAPIError.instance(statement, parameters, e)
sqlalchemy.exceptions.InterfaceError: (InterfaceError)
Error binding parameter 1 - probably unsupported type.
u'SELECT "Nalichnost".db_id AS "Nalichnost_db_id", "Nalichnost".cena
AS "Nalichnost_cena" FROM "Nalichnost"
WHERE coalesce("Nalichnost".cena, ?) = ? ORDER BY "Nalichnost".oid'
[0, Decimal("1")]
which the same as what was before r3762 for half of the
Decimal-passing queries.
i guess the funcs could return anything, so their return type is
probably unknown generally. For this one, i am generating the query,
so i could hint the bindparam something about the type of the
column - but i dont know what.
any idea?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---