Thanks for the advice. I think I'm now doing things the way you
prescribe. Below is the some skeletal code. Not sure if anyone else
will find it useful.

Note that this is simple, single-threaded and in a controlled
environment (I'm making excuses for the global variables...)

Other code can refer to the table objects before any db interaction
takes place. Different departments that use identical schemas, but
different db instances, can use the same API. They just supply the
connection information at run time.


# module  that gets imported by a generic db interface API

_engine = None
_meta = None

def openDB(...):
    global _engine
    _engine = create_engine(...)
    _meta.connect(_engine)

def closeDB():
    _engine.dispose()

# classes defined later in the same module
class Table1(object):
    pass

table1_tbl = Table('table1', _meta, Column('example', String(32),
primary_key=True))
Table1_mapper = mapper(Table1, table1_tbl)


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