[RFC] Minimizing `quary build` work when have `--cached-views`
Background
When running quary build, the operations it pushes are quite disruptive:
- dropping and recreating views
- dropping and recreating tables
- dropping and recreating materialized views
In the case of systems that track view dependencies at the moment we also run DROP <view_name> CASCADE.
This:
- breaks downstream systems
- can be un-necessary cost
In order to avoid this, we can use the --cached-views systems to do the minimum amount of work to 1 speed up CI jobs by only changing what is necessary and 2 be more reliable. At the moment it is only being used by the extension to speed up queries when developing.
Proposal
When running quary build --cached-views, we pull the cached views and for instances where it makes sense, we try to do the least disruptive work if the models have not changed.
| Cache Status | View | Table | Materialized View |
|---|---|---|---|
| Cached and matching | Leave | Rerun | Refresh Data |
| Not matching | Recreate | Rerun | Recreate |
Abandoned Ideas
See some discussion here: https://github.com/quarylabs/quary/issues/88
Sections
Implementation
Steps:
- [ ] Pull the views
- [x] In the create/drop view functions allow for optional return
- [ ] In the create/drop view functions return appropriately for all the things
- [ ] Tie up to the
quary buildcommand
UX
From a UX perspective this won't look all that different.
@kraftaa this is my current proposal, WDYT?
@louisjoecodes any thoughts, I think we should move issues here ...