partitioning.py 654 B

12345678910111213141516171819202122
  1. from dateutil.relativedelta import relativedelta
  2. from psqlextra.partitioning import (
  3. PostgresCurrentTimePartitioningStrategy,
  4. PostgresPartitioningManager,
  5. PostgresTimePartitionSize,
  6. )
  7. from psqlextra.partitioning.config import PostgresPartitioningConfig
  8. from apps.issue_events.models import IssueEvent
  9. manager = PostgresPartitioningManager(
  10. [
  11. PostgresPartitioningConfig(
  12. model=IssueEvent,
  13. strategy=PostgresCurrentTimePartitioningStrategy(
  14. size=PostgresTimePartitionSize(weeks=1),
  15. count=2,
  16. max_age=relativedelta(months=3),
  17. ),
  18. ),
  19. ]
  20. )