OPS-REF-002B: Split PostgreSQL source-family parameter mapping#651
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
postgresql_source_family_repository.pyby extracting master/detail parameter mapping and JSON payload helpers into a focused module while preserving runtime orchestration in the repository.Description
src/carbonfactor_parser/persistence/postgresql_source_family_parameters.pythat exposesmaster_parameters(record),detail_parameters(record),json_payload(value), andjson_safe(value)and implements the same tuple layouts and JSON conversion rules as before.src/carbonfactor_parser/persistence/postgresql_source_family_repository.pyto callmaster_parametersanddetail_parametersand removed the previous internal helpers from the repository file, keeping orchestration, upserts, transaction helpers, and error redaction in place.master_parameterscomputesingestion_run_uuid(record)once intoingestion_idbefore building the tuple to avoid repeated UUID calls while preserving deterministic behavior.Decimal->str, mapping keys sorted by string key, tuples/lists recursively converted to lists, and serialization usessort_keys=Trueandseparators=(",",":").tests/test_postgresql_source_family_repository.pyto assert master/detail tuple lengths/positions, UUID string values, compact metadata/raw/normalized JSON payloads, andjson_safebehavior.Testing
python -m pytest tests/test_postgresql_source_family_repository.pyand it passed (18 passed, 1 skipped).python -m pytest tests/test_configured_cycle_runner.py tests/test_ingestion_run_history_mapping.py tests/test_ingestion_run_history_repository.py tests/test_ingestion_run_history_reader.pyand they passed (50 passed).python -m pytestand it passed (2159 passed, 8 skipped).python -m ruff checkon the changed files andgit diff --check, both passed.Codex Task