diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-08-20 14:17:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-08-21 15:35:06 -0700 |
commit | cc7ebbc9afa540cff04989db1edb0913f0d46a54 (patch) | |
tree | 3832197bef70d3356f22a23153eee54063bf0d1d /python/fatcat_import.py | |
parent | daf91b137483b7345448b597289c78f8fb3f9969 (diff) | |
download | fatcat-cc7ebbc9afa540cff04989db1edb0913f0d46a54.tar.gz fatcat-cc7ebbc9afa540cff04989db1edb0913f0d46a54.zip |
initial implementation of file_meta importer
Diffstat (limited to 'python/fatcat_import.py')
-rwxr-xr-x | python/fatcat_import.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/python/fatcat_import.py b/python/fatcat_import.py index 252ab3a5..498683e0 100755 --- a/python/fatcat_import.py +++ b/python/fatcat_import.py @@ -236,6 +236,11 @@ def run_datacite(args): else: JsonLinePusher(dci, args.json_file).run() +def run_file_meta(args): + fmi = FileMetaImporter(args.api, + edit_batch_size=100) + JsonLinePusher(fmi, args.json_file).run() + def main(): parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -556,6 +561,16 @@ def main(): auth_var="FATCAT_AUTH_WORKER_DATACITE", ) + sub_file_meta = subparsers.add_parser('file-meta', + help="simple update-only importer for file metadata") + sub_file_meta.set_defaults( + func=run_file_meta, + auth_var="FATCAT_API_AUTH_TOKEN", + ) + sub_file_meta.add_argument('json_file', + help="File with jsonlines from file_meta schema to import from", + default=sys.stdin, type=argparse.FileType('r')) + args = parser.parse_args() if not args.__dict__.get("func"): print("tell me what to do!") |