3 ms·
Also don't underestimate setting up e.g. views or materialized views even that you can use through the ORM to query. It helps a lot and allows you to combine fi
by sgt 11mo ago
Also don't underestimate setting up e.g. views or materialized views even that you can use through the ORM to query. It helps a lot and allows you to combine fine tuning SQL with ease of use through Django, and get a lot of performance out of it. Just remember to create them in the migration scripts.
- aynyc 11mo agoAny docs? Django migration is a HUUGE pain point for us.
- WesleyJohnson 11mo agomanage.py makemigrations myapp --empty --name add_some_view (in the migration file) operations=[migrations.RunSQL("Create View some_view AS ....", "DROP VIEW IF EXISTS...."] (in your models.py) class SomeView(models.Model): class Meta: db_table = 'some_view' managed = False manage.py makemigrations myapp --name add_some_view_model
- sgt 11mo agoAn extremely common thing to do. Also great with materialized views. I bet it's documented somewhere in Django's docs.