On Jun 13, 2007, at 11:21 AM, kwarg wrote:

>
> I defined a model with several DB mapped entities. Here's one of them:
> ...
> address_table = Table("address", metadata, autoload = True)
> ...
> class Address(object):
>     pass
> ...
> assign_mapper(session.context, Address, address_table)
>
> Then in the controller an instance of Address class is modified ans
> saved:
> # 1. construct/read object
> a = Address.get(address_id)
> ...
> # 2. modification of object a properties
> ...
> # 3. save changes
> a.save()
> a.flush()
> All of 1., 2. and 3. use the same connection for interaction with the
> DB.
> I need to run my custom query in that connection before 3. executes.
> How can I get that connection?
> Thank you.

how are you creating the transaction ?  if via Connection, you have  
it.  if via SessionTransaction,  trans.connection(Address).execute 
(<your statement>), or alternatively session.context.connection 
(Address).execute(<your statement>).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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