Skip to content

tdfs4ds.migration.report

tdfs4ds.migration.report

Human-readable approval report for a cross-store migration manifest (v0.3.1.150). Cheap, no LLM — pure rendering of the plan dict.

KIND_LABELS module-attribute

KIND_LABELS = {'source_table': 'table', 'intermediate_view': 'view read by the processes', 'process_view': 'process view', 'dataset': 'dataset', 'downstream_view': 'view reading the datasets', 'unverified': 'not verified'}

LANES module-attribute

LANES = (('tables', 'Tables'), ('views', 'Views'), ('managers', 'Managers'), ('processes', 'Processes'), ('datasets', 'Datasets'), ('downstream', 'Downstream views'))

ACTIONS module-attribute

ACTIONS = (('create', 'created in the target', '#00233C'), ('identical', 'identical (kept)', '#1e8449'), ('exists', 'already there (reused / unified)', '#27ae60'), ('conflict', 'conflict: exists, different', '#FF5F00'), ('stays', 'stays where it is', '#95a5a6'), ('blocked', 'blocked (reads what is not migrated)', '#c0392b'), ('unverified', 'not verified', '#e2b007'))

_LANE_OF module-attribute

_LANE_OF = {'source_table': 'tables', 'intermediate_view': 'views', 'unverified': 'views', 'process_view': 'processes', 'dataset': 'datasets', 'downstream_view': 'downstream'}

_DIAGRAM_CSS module-attribute

_DIAGRAM_CSS = '<style>.td-migdiag{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#00233C;max-width:100%;margin:8px 0}.td-migdiag svg{width:100%;height:auto;display:block}.td-migdiag .lg{display:flex;flex-wrap:wrap;gap:10px;font-size:12px;margin:6px 0}.td-migdiag .sw{display:inline-block;width:11px;height:11px;border-radius:2px;margin-right:4px;vertical-align:-1px}.td-migdiag details{border:1px solid #E3E8EE;border-radius:6px;margin:4px 0;padding:4px 10px;background:#fff}.td-migdiag summary{cursor:pointer;font-weight:600;font-size:13px}.td-migdiag ul{margin:4px 0 6px;padding-left:18px;font-size:12px;max-height:320px;overflow:auto}.td-migdiag code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px;overflow-wrap:anywhere}.td-migdiag .ac{font-size:11px;padding:0 6px;border-radius:8px;color:#fff;margin-left:4px}</style>'

norm_name

norm_name(name: Optional[str]) -> str

Uppercase, de-quoted, stripped — the canonical comparison form.

_short

_short(name) -> str

_calendar_text

_calendar_text(value)

_gaps_text

_gaps_text(value)

render_migration_report

render_migration_report(plan: Dict[str, Any], fmt: str = 'markdown') -> str

Render the migration manifest as an approval-ready report.

Parameters

plan : dict A manifest from :func:tdfs4ds.plan_migration. fmt : 'markdown' | 'html' Output format (default markdown).

_kind_label

_kind_label(kind) -> str

_flagged

_flagged(plan: Dict[str, Any]) -> List[str]

Names of the processes with an error or warning finding: promoting one carries the problem to production.

_verdict_text

_verdict_text(v) -> str

_sanity_lines

_sanity_lines(plan: Dict[str, Any]) -> List[str]

_acceptance_lines

_acceptance_lines(plan: Dict[str, Any]) -> List[str]

_acceptance_html

_acceptance_html(plan: Dict[str, Any]) -> str

_access_lines

_access_lines(plan: Dict[str, Any]) -> List[str]

_render_markdown

_render_markdown(plan: Dict[str, Any]) -> str

_sanity_html

_sanity_html(plan: Dict[str, Any]) -> str

_access_html

_access_html(plan: Dict[str, Any]) -> str

_render_html

_render_html(plan: Dict[str, Any]) -> str

Compact self-contained HTML summary (for the admin panel).

kind_label

kind_label(kind) -> str

The people's name of an object kind of the plan (the raw kind when unknown).

_kept_in_place

_kept_in_place(plan) -> List[Dict[str, Any]]

_not_verified

_not_verified(plan) -> List[Dict[str, Any]]

_blocked_downstream

_blocked_downstream(plan) -> List[Dict[str, Any]]

_exists_text

_exists_text(v) -> str

_domain_map_text

_domain_map_text(plan) -> str

_identical_lines

_identical_lines(plan) -> List[str]

The objects kept because the target has them with the same definition (0.3.8.15), the processes kept as they are, and what refreshes the branch of a replaced object. [] when nothing is identical (a plan with nothing in the target renders as before).

_new_sections_md

_new_sections_md(plan) -> List[str]

_new_sections_html

_new_sections_html(plan) -> str

diagram_items

diagram_items(plan) -> Dict[str, List[Dict[str, str]]]

{lane: [{source, target, action}]} of the plan, one item per object / manager / clock. Pure.

render_migration_diagram

render_migration_diagram(plan: Dict[str, Any]) -> str

An inline SVG + scoped CSS fragment (no script) of the plan: the source store on the left, the target on the right, one lane per kind (tables, views, managers, processes, datasets, downstream views) with its count, the target box split by action, and under it one <details> panel per lane listing every object source -> target with its action.

write_migration_report

write_migration_report(plan: Dict[str, Any], out_path: Optional[str] = None, fmt: str = 'html') -> str

Write the approval report as a standalone page (fmt='html': doctype, charset, title "Migration plan", light theme, the diagram first) or Markdown (fmt='markdown') and return its path (default: tdfs4ds.SCHEDULING_SCRIPT_DIR or the working directory).