Commit dd5a3c0d authored by Wei Shoulin's avatar Wei Shoulin
Browse files

bugs

parent 5402e595
......@@ -9,14 +9,18 @@ from csst_dfs_api_local.common.db import DBClient
log = logging.getLogger('csst-dfs-api-local')
def ingest():
db = DBClient()
parser = argparse.ArgumentParser(prog=f"{sys.argv[0]}", description="ingest the local files")
parser.add_argument('-i','--infile', dest="infile", help="a file or a directory")
parser.add_argument('-m', '--copyfiles', dest="copyfiles", action='store_true', default=False, help="copy files after import")
args = parser.parse_args(sys.argv[1:])
import_root_dir = args.infile
if import_root_dir is None or (not os.path.isfile(import_root_dir) and not os.path.isdir(import_root_dir)):
parser.print_help()
sys.exit(0)
db = DBClient()
if os.path.isfile(import_root_dir):
log.info(f"prepare import {import_root_dir}")
ingesst_one(import_root_dir, db, args.copyfiles)
......
......@@ -68,7 +68,7 @@ def ingest_one(file_path, db, copyfiles):
filename = get_header_value("FILENAME", header, os.path.basename(file_path))
existed = db.exists(
"select * from t_level0_data where filename=?",
"select * from msc_level0_data where filename=?",
(filename,)
)
if existed:
......
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