I am aware of the cursor object in Django. Is there any other preferred way to execute raw SQL in migrations? I want to introduce postgresql partitioning for one of my model
I would recommend django-migrate-sql-deux https://pypi.org/project/django-migrate-sql-deux/
This way you can manage database objects like views, functions, triggers in declarative way like models in Django. Then you need generate changes into Django migrations through makemigrations. And apply them via migrate. So the development and deploy flow is pretty same.
It would be awesome if Django would have this system for raw SQL "models" and handle migrations and dependencies automatically in makemigrations and migrate commands like django-migrate-sql-deux.