[sqlalchemy] Re: Dynamic loader versus lazy=True

2009-09-15 Thread Wolodja Wentland
On Thu, Sep 10, 2009 at 23:27 +0200, Wolodja Wentland wrote: Hi all, I observed that if I define a relation (foo_query) as lazy='dynamic' and access all referenced entities with foo_query.all() that the query will be executed every time i access it. That is not a big surprise ;-) In a

[sqlalchemy] Re: Dynamic loader versus lazy=True

2009-09-15 Thread Alexandre Conrad
Keep in mind that the method on your Bar class: def all_foo(self): foo_query.all() will return a raw *list* of Foo objects. If you append more Foo objects to it, they won't be seen by SQLAlchemy's session, thus not being commited. Although, if you have set on your mapper:

[sqlalchemy] Re: Dynamic loader versus lazy=True

2009-09-15 Thread Alexandre Conrad
2009/9/10 Wolodja Wentland wentl...@cl.uni-heidelberg.de: Class Bar(object):    def all_foo(self):        foo_query.all()    def foo_startwith(self, search_string):        foo.query.filter(tbl.c.col.like('%s%%'% ...)) Note that a .startswith() method is already implemented in SA: