|
36 | 36 | _DESERIALIZER = TypeDeserializer() |
37 | 37 | EMPTY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
38 | 38 | _DEFAULT_DDB_TABLE_BASE = "ftrs-dos-local-database-healthcare-service" |
39 | | -_WS_ENV = (os.environ.get('WORKSPACE') or '').strip() |
40 | | -_WS_NORMALIZED = _WS_ENV.lstrip('-') if _WS_ENV else '' |
41 | | -DEFAULT_DDB_TABLE = _DEFAULT_DDB_TABLE_BASE + (f"-{_WS_NORMALIZED}" if _WS_NORMALIZED else "") |
| 39 | +DEFAULT_DDB_TABLE = _DEFAULT_DDB_TABLE_BASE |
| 40 | +DDB_IGNORE_WORKSPACE_DEFAULT = True |
42 | 41 | INDEXING_TIMEOUT_SECONDS = 60 |
43 | 42 | INDEX_PROPERTIES = MAPPINGS_PAYLOAD.get('mappings', {}).get('properties', {}) |
44 | 43 | PRIMARY_KEY_NAME = 'primary_key' if 'primary_key' in INDEX_PROPERTIES else None |
@@ -81,6 +80,8 @@ def parse_args(argv: Optional[list[str]] = None) -> argparse.Namespace: |
81 | 80 | parser.add_argument("--batch-size", dest="batch_size", type=int, default=1, help="Number of records to send in one bulk request (1 = per-document PUT)") |
82 | 81 | parser.add_argument("--log-level", dest="log_level", default=os.environ.get('LOG_LEVEL', 'INFO')) |
83 | 82 | parser.add_argument("--schema-config", dest="schema_config", help="Path to JSON schema config that maps DynamoDB attributes to OpenSearch fields") |
| 83 | + parser.add_argument("--dynamodb-table-ignore-workspace", dest="ddb_ignore_workspace", default=str(DDB_IGNORE_WORKSPACE_DEFAULT), |
| 84 | + help="true|false - when true do NOT append workspace to the DynamoDB table name (default: true)") |
84 | 85 | return parser.parse_args(argv) |
85 | 86 |
|
86 | 87 | def validate_inputs(open_search_domain: Optional[str], index: Optional[str]) -> None: |
@@ -460,9 +461,11 @@ def main(argv: Optional[list[str]] = None) -> int: |
460 | 461 | ddb_table = args.ddb_table |
461 | 462 | workspace = args.workspace or os.environ.get('WORKSPACE', '') |
462 | 463 |
|
463 | | - final_table = build_name_with_workspace(ddb_table, workspace) if ddb_table else ddb_table |
| 464 | + ddb_ignore_workspace = str(args.ddb_ignore_workspace).strip().lower() in ("1", "true", "yes") |
| 465 | + |
| 466 | + final_table = ddb_table if ddb_ignore_workspace or not ddb_table else build_name_with_workspace(ddb_table, workspace) |
| 467 | + |
464 | 468 | ws_raw = (workspace or "").strip() |
465 | | - # determine final index, defaulting to triage_code when workspace not set |
466 | 469 | if not ws_raw: |
467 | 470 | final_index = args.final_index or os.environ.get('OS_FINAL_INDEX') or "triage_code" |
468 | 471 | else: |
|
0 commit comments