I am not very familiar with SqlAlchemy, 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

I have googled a lot, but still not clear how to deal with this
situation.

this post has been presented in SA groups, but got no answer. so, as a
tg2 user,  I put it here.
wish I am not bothering you.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to