Skip to content

tdfs4ds.domain_removal

tdfs4ds.domain_removal

Removing a whole data domain (0.3.8.17).

A data domain is not an object of its own: it is the DATA_DOMAIN value carried by process and feature catalog rows, plus its settings rows (clock, calendar gaps, the DISPOSABLE mark). Removing it means removing what it owns, with the guarded removal plan of :mod:tdfs4ds.dependencies:

  • :func:plan_domain_removal (read only) plans every process of the domain, its features, the datasets built only from them, the managers only they use, its clock (view, table of dates, registry row) and settings rows, and, with purge_values, the stored values and the storage tables left empty. What is shared (a dataset mixing in features of another domain, a process of another domain reading a view of this one, a manager another process reads) is listed under kept with the reason and never removed;
  • :func:remove_data_domain is the one call, for a domain declared disposable only (create_data_domain(..., disposable=True)); a real domain goes through plan_domain_removal (or plan_removal) and apply_removal.

Feature-store objects only: source tables are never touched, nor read-only stores.

DomainNotDisposableError

Bases: ValueError

remove_data_domain refused: the domain was not declared disposable.

logger_safe

logger_safe(level, message, *args, **kwargs)

Wrapper around the global logger that only emits logs when tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.

domain_removal_objects

domain_removal_objects(domain, snapshot) -> list

What removing domain means, as :func:tdfs4ds.plan_removal objects: every process of the domain (its features and the datasets reading them follow as dependents), plus the domain's features no process computes any more, which no process step reaches. Primary store only. Pure on the snapshot frames.

_u

_u(v) -> str

storage_tables_of

storage_tables_of(domain, features) -> List[Dict[str, str]]

The FS_T_* tables (with their FS_V_* view) whose every current feature is of domain, from a feature catalog frame (all domains of the primary store). Pure.

clock_steps

clock_steps(domain, clock, plan, graph, processes, other_clocks) -> tuple

(steps, kept) for the clock of the domain being removed, pure.

Its view is dropped when no process outside the removal records it, no other domain uses it as its clock and nothing outside the removal reads it in the lineage; its table of dates too, when nothing else reads it (the soft clones of the removed processes are dropped by earlier steps).

plan_domain_removal

plan_domain_removal(data_domain, *, purge_values: bool = True, drop_views: bool = True) -> dict

The removal plan of a whole data domain, read only (0.3.8.17).

Owned-only (see :func:tdfs4ds.plan_removal): every process of the domain, its features, the datasets built only from them and the managers only they use; then the domain clock (view, table of dates, registry row, calendar rule) when nothing outside reads it, its settings rows, the DISPOSABLE mark last; with purge_values=True the stored values and the FS_T_* tables left empty. Shared objects are under plan["kept"]. Primary store only. Apply it with :func:tdfs4ds.apply_removal.

describe_removal_plan

describe_removal_plan(plan: dict) -> str

The plan as text: the steps in order, what is kept and why, what could not be read.

remove_data_domain

remove_data_domain(data_domain, *, dry_run: bool = True, purge_values: bool = True, refresh_index: bool = True) -> dict

Remove a disposable data domain and everything the feature store holds for it.

Only for a domain declared disposable (create_data_domain(..., disposable=True) or set_data_domain_disposable(domain, True)); any other domain is refused, and goes through plan_domain_removal (or plan_removal) and apply_removal.

dry_run=True (default) prints the plan and returns it, writing nothing. dry_run=False applies it with :func:tdfs4ds.apply_removal (which refuses a plan the store changed under, or one that would break an object of another domain). purge_values=True also deletes the stored values and the storage tables left empty. Shared objects are kept and listed. Source tables and read-only stores are never touched.