I've always wondered how to have a session that was not managed by the
Pyramid transaction manager. Thanks, Antonio!

-Vincent


On Wed, Dec 11, 2013 at 11:56 AM, Antonio Beamud Montero <
[email protected]> wrote:

>  El 11/12/13 19:22, Michael Merickel escribió:
>
> The SQLAlchemy session you're using is configured to use the ZTE. You can
> manage this session manually via transaction.commit() and
> transaction.abort(), but this is not recommended.
>
>  If you want to avoid pyramid_tm, it's simple. Just don't use a session
> configured to use the ZTE. You can easily create another session without
> the ZTE and bind it to the same engine (connection pool). You're then
> responsible for committing, closing, etc, but it will give you full control
> over the transactions within that view.
>
>
> If I have understood you, is something like that (with pyramid_tm enabled):
>
> DBSession =
> orm.scoped_session(orm.sessionmaker(extension=ZopeTransactionExtension()))
> SDBSession = orm.scoped_session(orm.sessionmaker())
>
> def my_method_view():
>     db = SDBSession()
>     req = UserRequest(....)
>     db.add(req)
>     db.commit()
>     ...
>     (long calls)
>     payment = Payment(....)
>     db.add(payment)
>     db.commit()
>     db.close()
>
> def other_view():
>     req = UserRequest(....)
>     DBSession.add(req)
>
> Is correct? I must take into account to close session database if a
> exception occurs, etc..
>
> Thanks.
>
>
>
>  - Michael
>
>
>
> On Wed, Dec 11, 2013 at 12:14 PM, Jonathan Vanasco 
> <[email protected]>wrote:
>
>> Not sure, and I have a similar need.
>>
>>  Have you considered offloading the 3rd Party HTTP requests into a
>> celery task though?  Your pyramid view would just queue a task, celery
>> could handle all the transaction stuff, and then you can use a refresh or
>> ajax call for the next view -- polling celery for the result.
>>   --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/pylons-discuss.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Vincent Catalano
Software Engineer and Web Ninja,
(520).603.8944

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to