Skip to content

Commit 89521c4

Browse files
committed
Update README
1 parent 90666b3 commit 89521c4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,23 @@ check the indexes on the table and delete any extra indexes and create any missi
320320
is done through the index name, so if you use custom names for your indexes, it might happen that it won't get updated
321321
on change of the content but not the name.
322322

323+
#### Refreshing dependencies / dependants
324+
325+
The `refresh` method on `MaterializedView` only refreshes the given view, not dependencies or dependants.
326+
If you want to refresh all views related to a given view(s), i.e. all dependencies and dependants, you can use the `refresh_specific_views` utility function.
327+
328+
```python
329+
from django_pgviews.refresh import refresh_specific_views
330+
331+
refresh_specific_views([SomeMaterializedView], concurrently=True, strict=True)
332+
```
333+
334+
Under the hood that function is implemented usingh three public utility functions from `django_pgviews.dependencies`, which you can use directly if you need more control over the refresh process:
335+
336+
- `get_views_dependendants`: Get all dependants of a given view(s).
337+
- `get_views_dependencies`: Get all dependencies of a given view(s).
338+
- `reorder_by_dependencies`: Reorder views to ensure that dependencies are refreshed before dependants.
339+
323340
### Schemas
324341

325342
By default, the views will get created in the schema of the database, this is usually `public`.

0 commit comments

Comments
 (0)