dcicutils 8.14.0.1b7__py3-none-any.whl → 8.14.0.1b8__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,7 @@ class Portal(PortalFromUtils):
38
38
 
39
39
  _DEFAULT_APP = "smaht"
40
40
  _SMAHT_ENV_ENVIRON_NAME = "SMAHT_ENV"
41
+ _DEFAULT_INI_FILE_FOR_LOAD = "development.ini"
41
42
 
42
43
  # Schema properties to ignore (by default) for the view schema usage.
43
44
  _IGNORE_PROPERTIES_ON_UPDATE = [
@@ -120,6 +121,8 @@ def main():
120
121
  parser.add_argument("--post", type=str, required=False, default=None, help="POST data.")
121
122
  parser.add_argument("--patch", type=str, required=False, default=None, help="PATCH data.")
122
123
  parser.add_argument("--upsert", type=str, required=False, default=None, help="Upsert data.")
124
+ parser.add_argument("--load", type=str, required=False, default=None, help="Load data via snovault.loadxl.")
125
+ parser.add_argument("--ini", type=str, required=False, default=None, help="INI file for data via snovault.loadxl.")
123
126
  parser.add_argument("--delete", type=str, required=False, default=None, help="Delete data.")
124
127
  parser.add_argument("--purge", type=str, required=False, default=None, help="Purge data.")
125
128
  parser.add_argument("--noignore", action="store_true", required=False, default=False,
@@ -143,6 +146,41 @@ def main():
143
146
  else:
144
147
  app = APP_SMAHT
145
148
 
149
+ if not (args.post or args.patch or args.upsert or args.delete or args.purge or args.load):
150
+ usage()
151
+
152
+ if args.load:
153
+ if args.post or args.patch or args.upsert or args.delete or args.purge:
154
+ _print("Cannot use any other update option"
155
+ "when using the --load option (to load data via snovault.loadxl).")
156
+ exit(1)
157
+ if args.env:
158
+ _print("The --env is not used for the --load option (to load data via snovault.loadxl).")
159
+ if args.schema:
160
+ _print("The --schema is not used for the --load option (to load data via snovault.loadxl).")
161
+ from snovault.loadxl import load_data
162
+ from dcicutils.captured_output import captured_output
163
+ if args.ini:
164
+ ini_file = args.ini
165
+ else:
166
+ ini_file = _DEFAULT_INI_FILE_FOR_LOAD
167
+ if not os.path.exists(ini_file):
168
+ _print(f"The INI file required for --load is not found: {ini_file}")
169
+ exit(1)
170
+ if not os.path.isdir(args.load):
171
+ _print(f"Load directory does not exist: {args.load}")
172
+ exit(1)
173
+ portal = None
174
+ with captured_output(not args.debug):
175
+ portal = Portal(ini_file)
176
+ if args.verbose:
177
+ _print(f"Loading data files into Portal (via snovault.loadxl) from: {args.load}")
178
+ _print(f"Portal INI file for load is: {ini_file}")
179
+ load_data(portal.vapp, indir=args.load, overwrite=True, use_master_inserts=False)
180
+ if args.verbose:
181
+ _print(f"Done loading data into Portal (via snovault.loadxl) files from: {args.load}")
182
+ exit(0)
183
+
146
184
  portal = _create_portal(env=args.env, app=app, verbose=args.verbose, debug=args.debug)
147
185
 
148
186
  if explicit_schema_name := args.schema:
@@ -150,9 +188,6 @@ def main():
150
188
  if not schema:
151
189
  usage(f"ERROR: Unknown schema name: {args.schema}")
152
190
 
153
- if not (args.post or args.patch or args.upsert or args.delete or args.purge):
154
- usage()
155
-
156
191
  if args.post:
157
192
  _post_or_patch_or_upsert(portal=portal,
158
193
  file_or_directory=args.post,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.14.0.1b7
3
+ Version: 8.14.0.1b8
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -60,7 +60,7 @@ dcicutils/s3_utils.py,sha256=h2B9ftOo-kxqfiKth5ZDC_cAUFy1Pbu7BrVanFnE5Iw,28839
60
60
  dcicutils/schema_utils.py,sha256=GmRm-XqZKJ6qine16SQF1txcby9WougDav_sYmKNs9E,12400
61
61
  dcicutils/scripts/publish_to_pypi.py,sha256=sMd4WASQGlxlh7uLrt2eGkFRXYgONVmvIg8mClMS5RQ,13903
62
62
  dcicutils/scripts/run_license_checker.py,sha256=z2keYnRDZsHQbTeo1XORAXSXNJK5axVzL5LjiNqZ7jE,4184
63
- dcicutils/scripts/update_portal_object.py,sha256=5ET0RtwSgIPt5z7WiSf_UuEow-J2Bs-GEpmvria09Pg,22557
63
+ dcicutils/scripts/update_portal_object.py,sha256=9_ZpfKwIJUDbyEI0Xqu_9keMxTIVZ_CyxX8WeGrFI14,24376
64
64
  dcicutils/scripts/view_portal_object.py,sha256=HONEHVu8Qs_ukdv8fHKqlJFLXHQn9xZyRDmcdBIQDqY,37140
65
65
  dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19745
66
66
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
75
75
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
76
76
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
77
77
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
78
- dcicutils-8.14.0.1b7.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
- dcicutils-8.14.0.1b7.dist-info/METADATA,sha256=HUAn-3SXVZZktV4SgAoJI5z9h-zZkij9v5QwF-a5WzQ,3439
80
- dcicutils-8.14.0.1b7.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
- dcicutils-8.14.0.1b7.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
- dcicutils-8.14.0.1b7.dist-info/RECORD,,
78
+ dcicutils-8.14.0.1b8.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
+ dcicutils-8.14.0.1b8.dist-info/METADATA,sha256=AkqjLjH1mspfSplr0gtPwbQehXK52wqZHo9mGvDya54,3439
80
+ dcicutils-8.14.0.1b8.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
+ dcicutils-8.14.0.1b8.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
+ dcicutils-8.14.0.1b8.dist-info/RECORD,,