Commit 2dfec5f9 authored by Danijel Schorlemmer's avatar Danijel Schorlemmer
Browse files

Added overwrite option to the command line

parent 54bf8633
Pipeline #20842 passed with stage
in 1 minute and 19 seconds
......@@ -50,7 +50,7 @@ def main():
"--database",
required=True,
type=str,
help="File path of the database",
help="File path of the exposure database",
)
parser.add_argument(
"-e",
......@@ -59,6 +59,13 @@ def main():
type=str,
help="File path of a SARA exposure-model file (any occupancy type)",
)
parser.add_argument(
"-o",
"--overwrite",
required=False,
action="store_true",
help="Overwrite the existing exposure database file",
)
parser.add_argument(
"-s",
"--spatialite-extension",
......@@ -76,13 +83,16 @@ def main():
exposure_filepath = args.exposure_filepath
spatialite_filepath = args.spatialite_extension
buildings_filepath = args.buildings_filepath
db = CoquimboDatabase(database_filepath, spatialite_filepath)
overwrite = args.overwrite
if command == "create":
if os.path.exists(database_filepath):
logger.warning("Database exists. Exiting ...")
exit()
if overwrite:
os.remove(database_filepath)
else:
logger.warning("Database exists. Exiting ...")
exit()
db = CoquimboDatabase(database_filepath, spatialite_filepath)
try:
db.create_connection_and_cursor()
except sqlite3.OperationalError:
......
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