I am not very familiar with SA, now I have a problem to query with
aggregate function.
Here is the class
--------------------------
class Directory(DeclarativeBase):
"""An ultra-simple group definition.
"""
__tablename__ = 'docman_directory'
dir_id = Column(Integer, autoincrement=True, primary_key=True)
code = Column(Integer,default=1)
parent_id = Column(Integer, ForeignKey('docman_directory.dir_id'))
--------------------------
I want to get the result of " select max(code) from docman_directory
where parent_id='222' ", what clause should I use with DBSession?
I have tried:
"DBSession.query(func.max('Document.doc_id')).filter_by
(parent_id=self.dir_id).one()"
but failed
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---