I have following class
class stockhistory(DeclarativeBase):
__tablename__ = 'stockhistory'
__table_args__ = {}
#column definitions
shrno = Column(u'shrno', BIGINT(), primary_key=True)
sprice = Column(u'sprice', FLOAT())
sstockex = Column(u'sstockex', VARCHAR(length=10))
ssymbol = Column(u'ssymbol', VARCHAR(length=10))
svolume = Column(u'svolume', BIGINT())
and a query which works fine and output is later
displayed in an paginated datagrid :
data = session.query(stockhistory).filter_by(ssymbol =
muid).order_by(desc('shrno')).limit(1000).all()
Now I want to improve the query by having the sprice column return
a precision of 2 decimal places.
In raw sql (Firebird) I would do this like :
cast(sprice as decimal(18,2)) as sprice
in sqlalchemy it maybe:
cast(sprice,Numeric(18,2))
but how to tell this to above query eludes me.
Thanks for any ideas.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/O4O44UlCB8IJ.
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.