strategy.py 606 B

123456789101112131415161718192021222324
  1. from abc import abstractmethod
  2. from typing import Generator
  3. from .partition import PostgresPartition
  4. class PostgresPartitioningStrategy:
  5. """Base class for implementing a partitioning strategy for a partitioned
  6. table."""
  7. @abstractmethod
  8. def to_create(
  9. self,
  10. ) -> Generator[PostgresPartition, None, None]:
  11. """Generates a list of partitions to be created."""
  12. @abstractmethod
  13. def to_delete(
  14. self,
  15. ) -> Generator[PostgresPartition, None, None]:
  16. """Generates a list of partitions to be deleted."""
  17. __all__ = ["PostgresPartitioningStrategy"]