Db
unread,Jun 2, 2012, 10:49:53 PM6/2/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlal...@googlegroups.com
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.