diff --git a/xbob/db/replay/create.py b/xbob/db/replay/create.py index a0b4c89bae1d49e31decf400cc7936f73a13ce61..1a2cb92535ecc192f191233c15b9e11def55f1f3 100644 --- a/xbob/db/replay/create.py +++ b/xbob/db/replay/create.py @@ -155,11 +155,9 @@ def define_protocols(session, protodir, verbose): def create_tables(args): """Creates all necessary tables (only to be used at the first time)""" - from bob.db.utils import connection_string + from bob.db.utils import create_engine_try_nolock - from sqlalchemy import create_engine - engine = create_engine(connection_string(args.type, args.files[0]), - echo=(args.verbose >= 2)) + engine = create_engine_try_nolock(args.type, args.files[0], echo=(args.verbose >= 2)) Client.metadata.create_all(engine) RealAccess.metadata.create_all(engine) Attack.metadata.create_all(engine) @@ -171,7 +169,7 @@ def create_tables(args): def create(args): """Creates or re-creates this database""" - from bob.db.utils import session + from bob.db.utils import session_try_nolock dbfile = args.files[0] @@ -185,7 +183,7 @@ def create(args): # the real work... create_tables(args) - s = session(args.type, args.files[0], echo=(args.verbose >= 2)) + s = session_try_nolock(args.type, args.files[0], echo=(args.verbose >= 2)) add_clients(s, args.protodir, args.verbose) add_real_lists(s, args.protodir, args.verbose) add_attack_lists(s, args.protodir, args.verbose) diff --git a/xbob/db/replay/query.py b/xbob/db/replay/query.py index 30e39a6c1b83cf267f4c4bd4c669bddb26cc0b6a..94f55899272610bd86901e6411de5b341e7a3fd2 100644 --- a/xbob/db/replay/query.py +++ b/xbob/db/replay/query.py @@ -34,7 +34,7 @@ class Database(object): self.session = None else: - self.session = utils.session(INFO.type(), INFO.files()[0]) + self.session = utils.session_try_readonly(INFO.type(), SQLITE_FILE) def is_valid(self): """Returns if a valid session has been opened for reading the database"""