arskom/rpclib — Issue #104: Problem with sqlalchemy.Date data type
Author: SunWukong
Created: 2011-10-25 12:21:52+00:00
State: open

I'm having problems with a Date value with this context :

class UserUpdate(TableModel, DeclarativeBase):
__namespace__ = nameSpace
__tablename__ = 'user_update'

user_id = Column(sqlalchemy.Integer)
date = Column(sqlalchemy.Date, nullable=True)
heure = Column(sqlalchemy.Time)

@rpc(Int(min_occurs=1, max_occurs=1),
_returns=Iterable(UserUpdate))
def tpz_getUserUpdate(ctx, user_id):
updates =
ctx.udc.session.query(UserUpdate).filter(UserUpdate.user_id ==
user_id).all()
return updates

I'm using a MySQL database where where those "date" and "heure" column
are respectively DATE and TIME types.

Thus, when calling the WS method above, I get the following error message :
[...]
File "C:\Python27\lib\site-packages\rpclib-2.4.4_beta-py2.7.egg\rpclib\model\primitive.py",
line 443, in to_string
if value.days < 0:
AttributeError: 'datetime.time' object has no attribute 'days'