diff --git a/generic_loader/load_folder.py b/generic_loader/load_folder.py index 099c419..9301786 100644 --- a/generic_loader/load_folder.py +++ b/generic_loader/load_folder.py @@ -47,6 +47,7 @@ USAGE :: python load_folder.py --config folder_config.yaml [--dry-run] [--fail-fast] + [--dbcreds] Flags: --config PATH Required. Path to the YAML config above. @@ -56,6 +57,11 @@ Flags: --fail-fast Abort the whole run on the first cluster failure. Default is to log the failure, roll that cluster back, and keep going. + --dbcreds Prompt interactively for the database username and + password instead of reading ``PGUSER`` / ``PGPASSWORD`` + from the environment or ``.env`` file. The password + prompt does not echo. Has no effect with ``--dry-run`` + (no connection is opened). Exit codes: 0 - every cluster loaded successfully (or dry-run completed) diff --git a/generic_loader/load_sas.py b/generic_loader/load_sas.py index 0be9602..614c4b4 100644 --- a/generic_loader/load_sas.py +++ b/generic_loader/load_sas.py @@ -57,6 +57,7 @@ the vars) before calling :func:`connect`. :: python load_sas.py --config path/to/config.yaml [--validate] [--dry-run] + [--dbcreds] Flags: --config PATH Required. Path to the YAML config above. @@ -66,6 +67,11 @@ Flags: ``--dry-run``. --dry-run Print the inferred ``CREATE TABLE`` SQL and stop. The database is never touched (no connection is opened). + --dbcreds Prompt interactively for the database username and + password instead of reading ``PGUSER`` / ``PGPASSWORD`` + from the environment or ``.env`` file. The password + prompt does not echo. Has no effect with ``--dry-run`` + (no connection is opened). Exit codes: 0 - success (load completed, or dry-run/validate passed) @@ -85,6 +91,9 @@ Typical invocations:: # Actually load the data. python load_sas.py --config sample_config.yaml + # Load the data, prompting for credentials instead of using .env. + python load_sas.py --config sample_config.yaml --dbcreds + 4. Expected-types manifest (``--validate``) ------------------------------------------- ``--validate`` looks for a JSON file named ``.expected.json`` next @@ -403,7 +412,7 @@ def _sas_reader(path: Path) -> Tuple[Any, Dict[str, Any]]: if suffix in (".xpt", ".xport"): return pyreadstat.read_xport, {} if suffix == ".sas7bdat": - return pyreadstat.read_sas7bdat, {"encoding": "latin-1"} + return pyreadstat.read_sas7bdat, {} raise ValueError(f"Unsupported SAS file extension: {suffix}")