You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -49,8 +49,8 @@ class PreferredCustomer(pg.View):
49
49
managed =False
50
50
```
51
51
52
-
**NOTE** It is important that we include the `managed = False` in the `Meta` so
53
-
Django 1.7 migrations don't attempt to create DB tables for this view.
52
+
> [!NOTE]
53
+
> It is important that we include the `managed = False` in the `Meta` so Django migrations don't attempt to create DB tables for this view.
54
54
55
55
The SQL produced by this might look like:
56
56
@@ -82,7 +82,7 @@ class PreferredCustomer(pg.View):
82
82
## Usage
83
83
84
84
To map onto a View, simply extend `pg_views.view.View`, assign SQL to the
85
-
`sql` argument and define a `db_table`. You must _always_ set `managed = False`
85
+
`sql` argument, and define a `db_table`. You must _always_ set `managed = False`
86
86
on the `Meta` class.
87
87
88
88
Views can be created in a number of ways:
@@ -132,12 +132,12 @@ class PreferredCustomer(pg.View):
132
132
managed =False
133
133
```
134
134
135
-
This will take all fields on `myapp.Customer` and apply them to
136
-
`PreferredCustomer`
135
+
This will take all fields on `myapp.Customer` and apply them to `PreferredCustomer`
137
136
138
137
## Features
139
138
140
139
### Configuration
140
+
141
141
`MATERIALIZED_VIEWS_DISABLE_SYNC_ON_MIGRATE`
142
142
143
143
When set to True, it skips running `sync_pgview` during migrations, which can be useful if you want to control the synchronization manually or avoid potential overhead during migrations. (default: False)
Sometimes your models change and you need your Database Views to reflect the new
151
-
data. Updating the View logic is as simple as modifying the underlying SQL and
152
-
running:
150
+
Sometimes your models change, and you need your Database Views to reflect the new data.
151
+
Updating the View logic is as simple as modifying the underlying SQL and running:
153
152
154
153
```
155
154
python manage.py sync_pgviews --force
@@ -159,12 +158,12 @@ This will forcibly update any views that conflict with your new SQL.
159
158
160
159
### Dependencies
161
160
162
-
You can specify other views you depend on. This ensures the other views are
163
-
installed beforehand. Using dependencies also ensures that your views get
164
-
refreshed correctly when using `sync_pgviews --force`.
161
+
You can specify other views you depend on.
162
+
This ensures the other views are installed beforehand.
163
+
Using dependencies also ensures that your views get refreshed correctly when using `sync_pgviews --force`.
165
164
166
-
**Note:** Views are synced after the Django application has migrated and adding
167
-
models to the dependency list will cause syncing to fail.
165
+
> [!NOTE]
166
+
> Views are synced after the Django application has migrated, and adding models to the dependency list will cause syncing to fail.
168
167
169
168
Example:
170
169
@@ -184,12 +183,9 @@ class PreferredCustomer(pg.View):
184
183
### Materialized Views
185
184
186
185
Postgres 9.3 and up supports [materialized views](http://www.postgresql.org/docs/current/static/sql-creatematerializedview.html)
187
-
which allow you to cache the results of views, potentially allowing them
188
-
to load faster.
186
+
which allow you to cache the results of views, potentially allowing them to load faster.
189
187
190
-
However, you do need to manually refresh the view. To do this automatically,
191
-
you can attach [signals](https://docs.djangoproject.com/en/1.8/ref/signals/)
192
-
and call the refresh function.
188
+
However, you do need to manually refresh the view. To do this automatically, you can attach [signals](https://docs.djangoproject.com/en/1.8/ref/signals/) and call the refresh function.
193
189
194
190
Example:
195
191
@@ -477,9 +473,13 @@ to pin views to specific databases.
477
473
<td>5.0</td>
478
474
<td>0.9.4</td>
479
475
</tr>
476
+
<tr>
477
+
<td>6.0</td>
478
+
<td>0.13.0</td>
479
+
</tr>
480
480
</tbody>
481
481
</table>
482
482
483
-
## Python 3 Support
483
+
## Python Support
484
484
485
-
Django PGViews Redux only officially supports Python 3.7+, it might work on 3.6, but there's no guarantees.
485
+
Django PGViews Redux only officially supports Python 3.10+, it might work on previous versions, but there are no guarantees.
0 commit comments