This is more of a best practice question:

I find having the framework manage the database session for you OK  95%
of the time.  What do you do in the other 5% of the time?

Example 1:  I have certain credit card processing methods that require
commits to the database before and after the card is processed.
Example 2: I have some methods that require no database interaction.
(So why create a session? .. also.. how much overhead is there in
creating the session?)

Anyone have any best practice ideas for situations like this?

Here is what I did on previous websites:
Background:
 1- When I 1st started Using SQLa, TG had no support for it but it
worked great by manually managing it.
 2- SQLalchemy support didn't work with TG.run_with_transaction for a
time when SQLA moved to version 2.x
Solutions:
 1-Manually manage SQLAlchemy transations
 2-Hack TG in my start script to avoid run_with_transaction altogether:

==snip==
# hack for sa 0.2.x
def nothing(func,*args,**kw):
        return func(*args,**kw)
turbogears.database.run_with_transaction=nothing
==end snip==

Anyway, I'm doing some new work and it would be the perfect time to get
rid of that hack but I don't have a real good solution for the 2
scenarios I mentioned above. 

Thoughts?
-Dennis


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to