On Jul 24, 7:19 pm, Michael Bayer mike...@zzzcomputing.com wrote:
[..]
finding a list of objects and the most recent/highest/somethingest
related item requires joining to a subquery, where the subquery selects
the func.max(desiredfield) and GROUP BY's the columns that relate the rows
to the
On Thu, Sep 3, 2009 at 8:05 AM, Noufal nou...@gmail.com wrote:
stmt = session.query(Order.table.c.client_id,func.max
(Order.table.c.date).label('latest_order')).group_by
(Order.table.c.date).subquery()
I think your group_by needs to be Order.table.c.client_id to get latest
order per
Im trying to run through this tutorial
http://www.sqlalchemy.org/docs/05/ormtutorial.html.
After running.
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
... __tablename__ = 'users'
...
... id = Column(Integer, primary_key=True)
not much idea. I'd make sure its not iPython screwing things up, I seem
to recall people having issues with it for some reason (which of course
seems ridiculous)
paulo wrote:
Im trying to run through this tutorial
http://www.sqlalchemy.org/docs/05/ormtutorial.html.
After running.
Hey guys,
I've had a really hard time with this issue and I'm hoping you can
tell me that I just have a caching issue (or something similar).
I have a system that manages related life cycle records. There is a
one to many relationship between a parent life cycle and many child
life cycles.
Any chance this is the second iteration of declaring the User class in this
session, and the first time was missing the primary_key?
I run into this in interactive sessions and need to call clear_mappers()
before redoing the class. It seems that the old mapper is still hanging
around and causes
I guess it's ipython cause when I tried saving the tutorial source code in a
file and run python .py everything
is working fine. Yeah you're right seems ridiculous. :)
On Thu, Sep 3, 2009 at 11:10 PM, Mike Conley mconl...@gmail.com wrote:
Any chance this is the second iteration of declaring
Daniel wrote:
So if there were five child_life_cycle records in the database and
three had values for doneProcessing and the other two didn't then I
would expect to get a 2 back from my query and not transition.
However, I'm finding that in some cases (when I look in my logs) the
query will
MUST we explicitly supply the join to such query objects? Or is there
some way that SA can figure out that tbl_people_documents is in
between tbl_people and tbl_documents on its own? Perhaps there is
something we can add to the tbl_people/tbl_documents object
definitions that clues SA
I am using InnoDB for transactional support. I also have a
timeLifeCycleInitialized field for each life cycle record and a
timeLifeCycleTransitioned for the parent record. I have verified that
the child records have existed for minutes to hours and have shown up
in previous queries, so it's not
Damon wrote:
MUST we explicitly supply the join to such query objects? Or is there
some way that SA can figure out that tbl_people_documents is in
between tbl_people and tbl_documents on its own? Perhaps there is
something we can add to the tbl_people/tbl_documents object
definitions
Thank you very much for the explanation. It is what I feared was the
case.
One of the great features we love about SA is the mappers, allowing us
to define table relationships in such a way that we can decide what
table(s) around which to pivot, giving us different ways of
returning data even
Damon wrote:
Thank you very much for the explanation. It is what I feared was the
case.
One of the great features we love about SA is the mappers, allowing us
to define table relationships in such a way that we can decide what
table(s) around which to pivot, giving us different ways of
you can explicitly create these many-to-many join relations and eager
load them.
users = session.query(User).options(eagerload(User.groups)).all()
if you want to query for relations with a filter, AFAIK you need to
define them as a separate relation.
class User(...)
groups =
On Sep 3, 6:15 pm, Mike Conley mconl...@gmail.com wrote:
On Thu, Sep 3, 2009 at 8:05 AM, Noufal nou...@gmail.com wrote:
stmt = session.query(Order.table.c.client_id,func.max
(Order.table.c.date).label('latest_order')).group_by
(Order.table.c.date).subquery()
I think your group_by
15 matches
Mail list logo