From a8258ce18ba92c3ee9e9ace8443ac3312637f1bd Mon Sep 17 00:00:00 2001 From: Christoph Blessing <33834216+cblessing24@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:23:38 +0100 Subject: [PATCH] Remove methods from facade --- link/adapters/facade.py | 2 +- link/infrastructure/facade.py | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/link/adapters/facade.py b/link/adapters/facade.py index 81a674b..a371623 100644 --- a/link/adapters/facade.py +++ b/link/adapters/facade.py @@ -51,7 +51,7 @@ def finish_delete_process(self, primary_keys: Iterable[PrimaryKey]) -> None: @abstractmethod def deprecate(self, primary_keys: Iterable[PrimaryKey]) -> None: - """Deprecate the entities identified by the given primary keys.""" + """Deprecate the entities identified by the given primary key.""" ProcessType = Literal["PULL", "DELETE", "NONE"] diff --git a/link/infrastructure/facade.py b/link/infrastructure/facade.py index f01cf2c..06d8ecd 100644 --- a/link/infrastructure/facade.py +++ b/link/infrastructure/facade.py @@ -3,10 +3,10 @@ from collections.abc import Callable from tempfile import TemporaryDirectory -from typing import Any, ContextManager, Iterable, Literal, Mapping, Protocol, Sequence, Union, cast +from typing import Any, ContextManager, Iterable, Literal, Mapping, Protocol, Sequence, Union from link.adapters import PrimaryKey -from link.adapters.facade import DJAssignment, DJAssignments, DJCondition, DJProcess, ProcessType +from link.adapters.facade import DJAssignment, DJCondition, DJProcess, ProcessType from link.adapters.facade import DJLinkFacade as AbstractDJLinkFacade @@ -66,28 +66,6 @@ def __init__(self, source: Callable[[], Table], outbound: Callable[[], Table], l self.outbound = outbound self.local = local - def get_assignments(self) -> DJAssignments: - """Get the assignments of primary keys to tables.""" - return DJAssignments( - cast("list[PrimaryKey]", self.source().proj().fetch(as_dict=True)), - cast("list[PrimaryKey]", self.outbound().proj().fetch(as_dict=True)), - cast("list[PrimaryKey]", self.local().proj().fetch(as_dict=True)), - ) - - def get_processes(self) -> list[DJProcess]: - """Get the current process (if any) from each entity in the outbound table.""" - rows = self.outbound().proj("process").fetch(as_dict=True) - processes: list[DJProcess] = [] - for row in rows: - process = row.pop("process") - processes.append(DJProcess(row, process)) - return processes - - def get_tainted_primary_keys(self) -> list[PrimaryKey]: - """Get the flagged (i.e. tainted) primary keys from the outbound table.""" - rows = (self.outbound() & 'is_flagged = "TRUE"').proj().fetch(as_dict=True) - return cast("list[PrimaryKey]", rows) - def get_assignment(self, primary_key: PrimaryKey) -> DJAssignment: """Get the assignment of the entity with the given primary key.""" return DJAssignment(