From 44d62a3e6d9b487f127e204aecc32afe5ada8d17 Mon Sep 17 00:00:00 2001 From: Korawich Anuttra Date: Tue, 7 May 2024 03:24:02 +0700 Subject: [PATCH] :construction: refactored: add method on services file that will implement. --- app/core/services.py | 14 ++++++++++++++ app/core/statements.py | 16 +++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/core/services.py b/app/core/services.py index baa5bb0..457a35e 100644 --- a/app/core/services.py +++ b/app/core/services.py @@ -132,6 +132,8 @@ def backup(self): ... def retention(self): ... + def init(self): ... + class NodeIngest(BaseNode): """Node for Ingestion""" @@ -148,6 +150,18 @@ def push(self): class Pipeline(PipelineCatalog): """Pipeline Service Model""" + def nodes(self): ... + + def log_push(self): ... + + def log_fetch(self): ... + + def check_triggered(self): ... + + def check_scheduled(self): ... + + def schedule_push(self): ... + class Task(BaseTask): """Task Service Model""" diff --git a/app/core/statements.py b/app/core/statements.py index 3ce132c..3b91312 100644 --- a/app/core/statements.py +++ b/app/core/statements.py @@ -159,7 +159,9 @@ def statement_check(self) -> str: ) def statement_create( - self, bk: bool = False, bk_name: Optional[str] = None + self, + bk: bool = False, + bk_name: Optional[str] = None, ) -> str: """Generate create statement @@ -182,9 +184,11 @@ def statement_create( ) return ( re.sub( - r"{database_name}\.{ai_schema_name}\.\w+", - f"{{database_name}}.{{ai_schema_name_backup}}." - f"{bk_name or f'{self.name}_bk'}", + r"{{database_name}\.{ai_schema_name}\.\w+", + ( + f"{{database_name}}.{{ai_schema_name_backup}}." + f"{bk_name or f'{self.name}_bk'}" + ), create_stm, ) if bk @@ -192,7 +196,9 @@ def statement_create( ) def statement_create_partition( - self, start: str, end: Optional[str] = None + self, + start: str, + end: Optional[str] = None, ) -> str: """Generate create partition statement