Typo in untested example.  session should be sess.

Randall

Randall Smith wrote:
> I'm wondering what is the best way for a mapped object to acquire a 
> connection for a non-ORM style query while staying within the context 
> (reuse connection or transaction) of its own session.  For example, here 
> is a method of a mapped object.
> 
>      @property
>      def analysis_count(self):
>          """Return a count of related analysis records.
> 
>          """
>          sess = object_session(self)
>          con = session.connect()
>          result = select([func.count(sample_analysis.c.id)], 
> 
>                          sample_analysis.c.batch_id == self.id,
>                          bind=con).execute().scalar()
>          return result
> 
> Is this correct and is there a better way to accomplish this?  I'm 
> working with SA 0.3.10.
> 
> Randall
> 
> 
> > 
> 


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