Project

General

Profile

« Previous | Next » 

Revision 646

bin/map: Print a message when a database is successfully connected to

View differences:

sql.py
196 196
    global DatabaseErrors
197 197
    DatabaseErrors = tuple(DatabaseErrors_set)
198 198

  
199
def connect(db_config):
199
def connect(db_config, serializable=True):
200 200
    db_config = db_config.copy() # don't modify input!
201 201
    module_name, mappings = db_engines[db_config.pop('engine')]
202 202
    module = __import__(module_name)
......
204 204
    for orig, new in mappings.iteritems():
205 205
        try: util.rename_key(db_config, orig, new)
206 206
        except KeyError: pass
207
    return module.connect(**db_config)
207
    db = module.connect(**db_config)
208
    if serializable:
209
        run_query(db, 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE')
210
    return db
211

  
212
def db_config_str(db_config):
213
    return db_config['engine']+' database '+db_config['database']

Also available in: Unified diff