[sqlalchemy] SA Obj Passed by Event Losing Relationship Column

2011-12-26 Thread jerryji
I noticed that the target objects passed in SA event are stripped off relationship columns. E.g., relationship column Post.user -- class User(Base): __tablename__ = 'users' user_id = Column(Unicode(32), primary_key=True) user_name = Column(Unicode(32)) ... class Post(Base):

Re: [sqlalchemy] 0.7 event migration

2011-12-26 Thread Kent
Documentation for AttributeImpl.callable_ still reads optional function which generates a callable based on a parent instance, which produces the default values for a scalar or collection attribute when it's first accessed, if not present already. But it seems it

[sqlalchemy] Self-Referential Many-to-Many Relationship example

2011-12-26 Thread k.elkouhen
In the example included in the 0.7 documentation, I can't figure out how the code backref=left_nodes works ? Notably, because I can't find a reference to left_nodes... from sqlalchemy import Integer, ForeignKey, String, Column, Tablefrom sqlalchemy.ext.declarative import declarative_basefrom

Re: [sqlalchemy] SA Obj Passed by Event Losing Relationship Column

2011-12-26 Thread Michael Bayer
On Dec 26, 2011, at 7:34 AM, jerryji wrote: I noticed that the target objects passed in SA event are stripped off relationship columns. E.g., relationship column Post.user -- class User(Base): __tablename__ = 'users' user_id = Column(Unicode(32), primary_key=True) user_name

Re: [sqlalchemy] 0.7 event migration

2011-12-26 Thread Michael Bayer
On Dec 26, 2011, at 9:07 AM, Kent wrote: Documentation for AttributeImpl.callable_ still reads optional function which generates a callable based on a parent instance, which produces the default values for a scalar or collection attribute when it's first accessed, if

Re: [sqlalchemy] Self-Referential Many-to-Many Relationship example

2011-12-26 Thread Michael Bayer
On Dec 26, 2011, at 9:56 AM, k.elkouhen wrote: In the example included in the 0.7 documentation, I can't figure out how the code backref=left_nodes works ? Notably, because I can't find a reference to left_nodes... left_nodes and right_nodes are essentially equivalent collections: n1,

[sqlalchemy] Re: 0.7 event migration

2011-12-26 Thread Kent
Yes, a nice simplification. I'm using it to lazyload attributes for objects that aren't in a session. I'm not sure if you pointed me there, I think I found it myself, but you helped work out the later details... Our app lives inside a webserver framework that, very appropriately, in my opinion,

[sqlalchemy] Re: 0.7 event migration

2011-12-26 Thread Kent
think I'll put: state.session_id = None in a finally block, but you get the idea On Dec 26, 1:50 pm, Kent jkentbo...@gmail.com wrote: Yes, a nice simplification. I'm using it to lazyload attributes for objects that aren't in a session.  I'm not sure if you pointed me there, I think I found it

[sqlalchemy] Re: sqlalchemy and redis caching

2011-12-26 Thread Mengu
hi michael, thank you very much for your response. i have read the beaker cache examples but i am yet to grasp it. the current solution i have found is querying the relationships as well with the joinedload() and caching the result. after i fully understand what is going on and how to do it