Sqlalchemy layout with WSGI application
        Posted  
        
            by TheDude
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by TheDude
        
        
        
        Published on 2010-03-24T04:57:58Z
        Indexed on 
            2010/03/24
            5:03 UTC
        
        
        Read the original article
        Hit count: 325
        
python
|sqlalchemy
I'm working on writing a small WSGI application using Bottle and SqlAlchemy and am confused on how the "layout" of my application should be in terms of SqlAlchemy.
My confusion is with creating engines and sessions. My understanding is that I should only create one engine with the 'create_engine' method. Should I be creating an engine instance in the global namespace in some sort of singleton pattern and creating sessions based off of it? How have you done this in your projects?
Any insight would be appreciated. The examples in the documentation dont seem to make this entirely clear (unless I'm missing something obvious). Any thoughts?
© Stack Overflow or respective owner