Skip to content
Snippets Groups Projects

Add spreadsheet factory functionality to copy_absolutes.py

1 file
+ 9
6
Compare changes
  • Side-by-side
  • Inline
@@ -58,6 +58,10 @@ def copy_absolutes(
help="Residual spreadsheet directory",
),
factory: ResidualFactory = ResidualFactory.WEB_ABSOLUTES,
force: bool = typer.Option(
default=False,
help="Force skip the check to copy absolutes",
),
):
"""Copy absolutes from the web absolutes service OR residual spreadsheets into the metadata service."""
if factory.value == ResidualFactory.WEB_ABSOLUTES:
@@ -73,12 +77,11 @@ def copy_absolutes(
)
# confirm whether or not to copy absolutes
print(f"Found {len(readings)} absolutes")
copy = typer.confirm(f"Are you sure you want to copy {len(readings)} absolutes?")
if not copy:
print("Not copying absolutes")
raise typer.Abort()
print("Copying over absolutes")
if not force:
typer.confirm(
f"Are you sure you want to copy {len(readings)} absolutes?", abort=True
)
print("Copying over absolutes")
# write readings to metadata service
metadata_factory = MetadataFactory(token=metadata_token, url=metadata_url)
Loading