I'm using Pylons + Python and am trying to figure how how to connect to our central database server only when necessary.
I created a class called Central() which I would like to instantiate whenever a connection to the central database server is necessary, e.g.:
class Central():
def __init__(self):
engine = engine_from_config(config, 'sqlalchemy.central.')
central_db = create_engine(engine)
print central_db
However this doesn't work when I call:
c = DBConnect.Central()
What is the proper code for doing this?
Thanks.