from abc import abstractmethod from typing import Any, Dict from ...base import BaseStep from ...mixins import SnowflakeMixin __all__ = ["AggregatesExtractBase"] class AggregatesExtractBase(SnowflakeMixin, BaseStep): @property @abstractmethod def query(self) -> str: pass @property @abstractmethod def raw_data_path(self) -> str: pass @property @abstractmethod def partition_key(self): pass files_count: int = 100 def process(self) -> Dict[str, Any]: result = self.export( self.query, self.raw_data_path, options=(f"PARTITION BY CAST({self.partition_key} % {self.files_count} AS INTEGER)",), ) return {"extracted_data_report": result}