Commit c95e1b48 authored by André Anjos's avatar André Anjos 💬
Browse files

Fix verbosity flag behavior

parent e40e9e1f
......@@ -292,7 +292,8 @@ def create_tables(args):
from bob.db.utils import connection_string
from sqlalchemy import create_engine
engine = create_engine(connection_string(args.type, args.files[0]), echo=args.verbose)
engine = create_engine(connection_string(args.type, args.files[0]),
echo=(args.verbose >= 2))
Client.metadata.create_all(engine)
File.metadata.create_all(engine)
Protocol.metadata.create_all(engine)
......@@ -308,8 +309,6 @@ def create(args):
dbfile = args.files[0]
args.verbose = 0 if args.verbose is None else sum(args.verbose)
if args.recreate:
if args.verbose and os.path.exists(dbfile):
print('unlinking %s...' % dbfile)
......@@ -334,7 +333,7 @@ def add_command(subparsers):
parser.add_argument('-R', '--recreate', action='store_true', default=False,
help="If set, I'll first erase the current database")
parser.add_argument('-v', '--verbose', action='append_const', const=1,
parser.add_argument('-v', '--verbose', action='count',
help="Do SQL operations in a verbose way")
parser.add_argument('-D', '--imagedir', action='store', metavar='DIR',
default='/idiap/temp/cmccool/databases/biosecure/raw',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment