I'm not especially familiar with this code. I understand subclassing query and adding @_generative method to capture the state, but could you point to an example or expound a little for how I get my query class to add to the end of the select(). I'm not /*replacing* / _compile_context I hope, right? Rather I would invoke super()._compile_context() and tack the FOR UPDATE to its result context.statement? I'm unclear on what type of class I'd subclass for the target of my @compiles() decorator and, more importantly, how I incorporate that class (would I make that class *hold* the context.statement and then when compiling, invoke compiler.process() on the statement and tack %s FOR UPDATE OF %s to the end?
Thanks again. On Feb 3, 5:06 pm, Michael Bayer <[email protected]> wrote: > Theres a ticket to support database-specific FOR UPDATE options in trac, for > now you'd need to use the usual routes into modifying the select statement > (@compiles for the select() construct, place extra _state on the select() > object read by your function, regexp it into the string, subclass Query to > add a new generative method to establish the state on Query and override > _compile_context to plug it onto context.statement). > > Or if you want to provide a full patch with unit tests, that works too and > I'll commit. > > On Feb 3, 2011, at 4:39 PM, Kent wrote: > > > session.query(Cls).with_lockmode('update') > > > will render "FOR UPDATE" > > > Is there a way to render "FOR UPDATE OF <table or column>"? > > > I ask because postgresql complains about locking FOR UPDATE when given > > an outer join. BUT, it is happy if you say "FOR UPDATE OF <left hand > > table>" given an outer join. > > > Thanks in advance, > > Kent > > > -- > > 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 > > athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- 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.
