-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Feature Request
Description:
Provide lifecycle hooks (before_refresh, after_refresh) that can be configured to run before and after a materialized view is refreshed.
Use Case:
This allows developers to inject custom logic into the refresh process, such as logging to an audit trail, busting external caches, or triggering other downstream processes.
Proposed Solution:
- In the initializer, allow configuration of global
before_refreshandafter_refreshlambdas that receive the view definition as an argument. - Allow these to be defined on a per-view basis as well, perhaps as serialized attributes on the model.
- The
MatViewRefreshJobwill execute these hooks at the appropriate times.
RSpec Tests:
- Configure a
before_refreshhook that sets a flag. - Run a refresh and verify the flag was set before the refresh SQL was executed.
- Configure an
after_refreshhook. - Run a successful refresh and a failed refresh, and verify the hook is called in both cases with the correct status.
Checklist:
- I have searched for a similar feature request and didn't find any duplicates.
- I have included all the required information.
- I have tagged the issue with the label "enhancement".
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Backlog