forked from tddschn/easygraph-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_bench_results_db.py
More file actions
executable file
·50 lines (39 loc) · 1.03 KB
/
create_bench_results_db.py
File metadata and controls
executable file
·50 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""
Author : Xinyuan Chen <45612704+tddschn@users.noreply.github.com>
Date : 2022-09-25
Purpose: Create sqlite3 db and tables
"""
import argparse
from pathlib import Path
import sqlite3
from utils_db import init_db
from config import bench_results_db_path
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Create sqlite3 db and tables',
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
'--db-path',
metavar='PATH',
type=Path,
help='Path to the database',
default=bench_results_db_path,
)
parser.add_argument(
'-f',
'--force',
help='Force overwrite existing db',
action='store_true',
)
return parser.parse_args()
def main() -> None:
args = get_args()
if args.force:
args.db_path.unlink(missing_ok=True)
with sqlite3.connect(args.db_path) as conn:
init_db(conn)
if __name__ == '__main__':
main()