Hi all, Does anyone know where and how to implement the reading and execution of a sql script file to create all database objects before run the unit tests?
I've created a "create_objects.py" file with the below code and a "database_objects.sql" script file with the creation of my database stored procedures. This is what I have tried so far ``` from django.db import migrations, connection import os def load_data_from_sql(apps, schema_editor): file_path = os.path.join(os.path.dirname(__file__), 'database_objects.sql') sql_statement = open(file_path).read() with connection.cursor() as c: c.execute(sql_statement) class Migration(migrations.Migration): operations = [migrations.RunPython(load_data_from_sql)] ``` But, I'm getting this error. django.db.utils.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") Any idea how can I make this work? Thank you very much in advance. Regards, Alex -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.