tha-map-runner 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/PKG-INFO +4 -4
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/README.md +3 -3
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/pyproject.toml +1 -1
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/src/tha_map_runner/__init__.py +1 -1
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/src/tha_map_runner/mapper.py +2 -2
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/tests/test_mapper.py +34 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/.github/workflows/ci.yml +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/.github/workflows/publish.yml +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/.gitignore +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/LICENSE +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/src/tha_map_runner/errors.py +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/src/tha_map_runner/paths.py +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/src/tha_map_runner/py.typed +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/tests/conftest.py +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/tests/test_paths.py +0 -0
- {tha_map_runner-0.2.3 → tha_map_runner-0.2.4}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tha-map-runner
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A Tabular Helper API library that maps and joins dict-like data into row dicts using dotted-path projection.
|
|
5
5
|
Project-URL: Homepage, https://github.com/tha-guy-nate/tha-map-runner
|
|
6
6
|
Project-URL: Issues, https://github.com/tha-guy-nate/tha-map-runner/issues
|
|
@@ -171,7 +171,7 @@ mapper.enrich_from_ddb(
|
|
|
171
171
|
|
|
172
172
|
Provide exactly one of `table_name` or `table_name_col` — not both, not neither.
|
|
173
173
|
|
|
174
|
-
`not_found` entries in `ddb_result` are filtered automatically and treated as missing matches.
|
|
174
|
+
`not_found` and `error` entries in `ddb_result` are filtered automatically and treated as missing matches.
|
|
175
175
|
|
|
176
176
|
**Single-table** — all rows look up against the same table:
|
|
177
177
|
|
|
@@ -182,8 +182,8 @@ enriched = mapper.enrich_from_ddb(rows, all_ddb, "user_id", {"Name": "name"}, ta
|
|
|
182
182
|
**Multi-table (chained)** — one call per table, each scoped explicitly:
|
|
183
183
|
|
|
184
184
|
```python
|
|
185
|
-
all_ddb = {**ddb.
|
|
186
|
-
**ddb.
|
|
185
|
+
all_ddb = {**ddb.batch_fetch_by_pk("users_table", user_ids, key_name="id", key_type="S"),
|
|
186
|
+
**ddb.batch_fetch_by_pk("orders_table", order_ids, key_name="id", key_type="S")}
|
|
187
187
|
|
|
188
188
|
enriched = mapper.enrich_from_ddb(rows, all_ddb, "user_id", {"Name": "name"}, table_name="users_table")
|
|
189
189
|
enriched = mapper.enrich_from_ddb(enriched, all_ddb, "order_id", {"Status": "status"}, table_name="orders_table")
|
|
@@ -146,7 +146,7 @@ mapper.enrich_from_ddb(
|
|
|
146
146
|
|
|
147
147
|
Provide exactly one of `table_name` or `table_name_col` — not both, not neither.
|
|
148
148
|
|
|
149
|
-
`not_found` entries in `ddb_result` are filtered automatically and treated as missing matches.
|
|
149
|
+
`not_found` and `error` entries in `ddb_result` are filtered automatically and treated as missing matches.
|
|
150
150
|
|
|
151
151
|
**Single-table** — all rows look up against the same table:
|
|
152
152
|
|
|
@@ -157,8 +157,8 @@ enriched = mapper.enrich_from_ddb(rows, all_ddb, "user_id", {"Name": "name"}, ta
|
|
|
157
157
|
**Multi-table (chained)** — one call per table, each scoped explicitly:
|
|
158
158
|
|
|
159
159
|
```python
|
|
160
|
-
all_ddb = {**ddb.
|
|
161
|
-
**ddb.
|
|
160
|
+
all_ddb = {**ddb.batch_fetch_by_pk("users_table", user_ids, key_name="id", key_type="S"),
|
|
161
|
+
**ddb.batch_fetch_by_pk("orders_table", order_ids, key_name="id", key_type="S")}
|
|
162
162
|
|
|
163
163
|
enriched = mapper.enrich_from_ddb(rows, all_ddb, "user_id", {"Name": "name"}, table_name="users_table")
|
|
164
164
|
enriched = mapper.enrich_from_ddb(enriched, all_ddb, "order_id", {"Status": "status"}, table_name="orders_table")
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tha-map-runner"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.4"
|
|
8
8
|
description = "A Tabular Helper API library that maps and joins dict-like data into row dicts using dotted-path projection."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -153,7 +153,7 @@ class ThaMap:
|
|
|
153
153
|
fixed_index = {
|
|
154
154
|
pk: record
|
|
155
155
|
for pk, record in ddb_result[table_name].items()
|
|
156
|
-
if not record.get("not_found")
|
|
156
|
+
if not record.get("not_found") and "error" not in record
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
output: list[dict] = []
|
|
@@ -167,7 +167,7 @@ class ThaMap:
|
|
|
167
167
|
if table_name_col:
|
|
168
168
|
tbl = str(row.get(table_name_col) or "")
|
|
169
169
|
record = ddb_result.get(tbl, {}).get(key_val) # type: ignore[arg-type]
|
|
170
|
-
match = record if record and not record.get("not_found") else None
|
|
170
|
+
match = record if record and not record.get("not_found") and "error" not in record else None
|
|
171
171
|
else:
|
|
172
172
|
match = fixed_index.get(key_val)
|
|
173
173
|
|
|
@@ -554,6 +554,22 @@ def test_enrich_from_ddb_not_found_treated_as_no_match(mapper, ddb_result, ddb_r
|
|
|
554
554
|
assert "Name" not in result[2]
|
|
555
555
|
|
|
556
556
|
|
|
557
|
+
def test_enrich_from_ddb_error_treated_as_no_match(mapper, ddb_rows, ddb_mapping):
|
|
558
|
+
ddb_result = {
|
|
559
|
+
"users_table": {
|
|
560
|
+
"user-001": {"name": "Alice", "role": "admin"},
|
|
561
|
+
"user-002": {"error": "AccessDeniedException"},
|
|
562
|
+
"user-003": {"not_found": True},
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
result = mapper.enrich_from_ddb(
|
|
566
|
+
ddb_rows, ddb_result, "user_id", ddb_mapping, table_name="users_table"
|
|
567
|
+
)
|
|
568
|
+
assert result[0]["Name"] == "Alice"
|
|
569
|
+
assert "Name" not in result[1]
|
|
570
|
+
assert "Name" not in result[2]
|
|
571
|
+
|
|
572
|
+
|
|
557
573
|
def test_enrich_from_ddb_multi_table(mapper, ddb_result, ddb_mapping):
|
|
558
574
|
rows = [{"user_id": "user-001", "order_id": "order-001", "Start Date": "08/15"}]
|
|
559
575
|
result = mapper.enrich_from_ddb(
|
|
@@ -697,3 +713,21 @@ def test_enrich_from_ddb_table_name_col_not_found_no_match(mapper, ddb_result, d
|
|
|
697
713
|
rows, ddb_result, "user_id", ddb_mapping, table_name_col="tbl"
|
|
698
714
|
)
|
|
699
715
|
assert "Name" not in result[0]
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
def test_enrich_from_ddb_table_name_col_error_treated_as_no_match(mapper, ddb_mapping):
|
|
719
|
+
ddb_result = {
|
|
720
|
+
"users_table": {
|
|
721
|
+
"user-001": {"name": "Alice", "role": "admin"},
|
|
722
|
+
"user-002": {"error": "AccessDeniedException"},
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
rows = [
|
|
726
|
+
{"user_id": "user-001", "tbl": "users_table"},
|
|
727
|
+
{"user_id": "user-002", "tbl": "users_table"},
|
|
728
|
+
]
|
|
729
|
+
result = mapper.enrich_from_ddb(
|
|
730
|
+
rows, ddb_result, "user_id", ddb_mapping, table_name_col="tbl"
|
|
731
|
+
)
|
|
732
|
+
assert result[0]["Name"] == "Alice"
|
|
733
|
+
assert "Name" not in result[1]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|