Feature: declare retention, compression in models#60
Draft
voarsh2 wants to merge 3 commits into
Draft
Conversation
This commit adds support for TimescaleDB's retention policy and compression features: - Add RetentionPolicy class with methods to add and remove retention policies - Add CompressionPolicy class with methods to enable compression, add/remove policies, and get stats - Extend TimescaleManager with methods for managing retention and compression - Add comprehensive tests using TransactionTestCase for self-contained testing - Update README with examples of how to use the new APIs, including in migrations These APIs provide a programmatic way to manage TimescaleDB's data lifecycle features. The implementation uses a method-based approach where you call methods on the `timescale` manager, rather than a declarative approach in model definitions. Part of Milestone 2 roadmap. roadmap. Ref: jamessewell#23
This commit introduces a comprehensive set of migration operations for managing TimescaleDB retention and compression policies in Django. Key additions include: - New `TimescaleConfig` class for app configuration. - Migration operations for adding and removing retention and compression policies. - A module for TimescaleDB migration operations, including examples and usage documentation. - Unit tests to ensure the functionality of the migration operations. These changes enhance the integration of TimescaleDB with Django's migration framework, allowing for declarative management of data lifecycle features.
Implement production-ready TimescaleDB policy management system with both declarative and programmatic APIs, featuring complete test coverage and robust error handling. Core improvements: - Fix retention policy removal to return correct boolean values - Enhance compression policy handling consistency - Resolve Django migration state handling issues - Improve error handling for edge cases Testing infrastructure: - Add comprehensive test suite (77 tests, 100% pass rate) - Implement self-contained test architecture - Fix Django configuration in all test files - Add individual migration operation testing - Cover real-world scenarios and edge cases Features: - Declarative policy definition via model TimescalePolicies class - Programmatic API with 5 individual migration operations - Automatic migration generation and policy updates - Data-safe policy changes with existing data preservation - Backward compatibility with existing implementations This makes the TimescaleDB Django integration production-ready with maximum flexibility for different use cases while maintaining full compatibility and data safety.
|
This looks great, thanks for sharing! @jamessewell, we would love your inputs |
|
Would be great to get this reviewed please @jamessewell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building upon #56
@jamessewell
Can you get a chance to review this? Would be a shame to have wasted my time and effort on this for something that was asked on this repo for a while.
This is model declaration of the policies, building on top of the programmatic API's for retention policy and compression