popoto.transfer.results¶
popoto.transfer.results
¶
Result types returned by :mod:popoto.transfer.
:class:ExportResult reports what an export wrote. :class:ImportReport is
the reconciliation ledger: every record in the export file is accounted for in
exactly one of five outcome categories, with a reason string attached to every
non-landed record.
CATEGORIES = (LANDED, SKIPPED, REJECTED, ERRORED, PARTIAL)
module-attribute
¶
The five outcome categories, in report order.
landed
Saved and all carried state restored.
skipped
Key already present on the destination and on_conflict="skip".
rejected
Refused before any write -- the write gate said no, or construction or
validation failed. Nothing was written.
errored
Failed during save, or the write could not be confirmed afterwards.
Nothing was written, or the write state is indeterminate.
partial
Saved, but restoring carried state raised. The record exists on the
destination with rebuild-default auxiliary state. This is the only
category that leaves degraded data behind, so it is surfaced first in
:meth:ImportReport.summary.
ExportResult
dataclass
¶
Outcome of an :func:popoto.transfer.export_records call.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
|
filter |
'str | None'
|
Rendered provenance of the applied filter, or |
filter_kwargs |
dict
|
The plain keyword filters that were forwarded. |
matched_count |
int
|
Number of keys the filter resolved to, at resolution
time. Compare against :attr: |
record_count |
int
|
Number of record lines actually written. |
vanished |
int
|
Keys that resolved but no longer had a hash when their chunk was hydrated. Export is not a point-in-time snapshot, so this is a counted fact rather than an error. |
filtered_out |
int
|
Records dropped by a client-side (unindexed) filter after hydration. |
warnings |
list
|
Non-fatal notes, e.g. a client-side filter downgrade or a
field whose |
errors |
list
|
Records that could not be serialized, with the reason. |
data |
'str | None'
|
The full JSONL text when no |
Source code in src/popoto/transfer/results.py
summary()
¶
Render a human-readable multi-line summary.
Source code in src/popoto/transfer/results.py
RecordOutcome
dataclass
¶
One record's fate during import.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
The record's redis_key, or |
category |
str
|
One of :data: |
reason |
'str | None'
|
Why, for anything that is not |
Source code in src/popoto/transfer/results.py
ImportReport
dataclass
¶
Reconciliation ledger for an :func:popoto.transfer.import_records call.
Every record line in the export file produces exactly one
:class:RecordOutcome, so len(outcomes) equals the number of record
lines read and the five category counts sum to it.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
|
outcomes |
list
|
Per-record outcomes in file order. |
fidelity |
dict
|
The manifest's per-field and per-mixin |
warnings |
list
|
Non-fatal notes (embedding provenance mismatches that were
carried, and so on). Unknown field names in carried state are
fatal for that record instead: they raise inside
|
write_gate_bypassed |
int
|
How many records were saved with the destination's write gate deliberately bypassed. |
source_matched_count |
'int | None'
|
The manifest's |
Source code in src/popoto/transfer/results.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
total
property
¶
Number of record lines accounted for.
add(key, category, reason=None)
¶
Record one record's outcome and return it.
Source code in src/popoto/transfer/results.py
by_category(category)
¶
count(category)
¶
summary()
¶
Render counts, every non-landed reason, and the fidelity roll-up.
partial is called out ahead of the ordinary counts because it is
the one category that leaves a queryable record behind whose auxiliary
state was never restored -- it needs attention, not just tallying.