Skip to content

fix: make RunSQLFromFile run the sql provided#41

Merged
davecoates merged 2 commits intomasterfrom
fix/runsqlfromfile-bug
Dec 18, 2025
Merged

fix: make RunSQLFromFile run the sql provided#41
davecoates merged 2 commits intomasterfrom
fix/runsqlfromfile-bug

Conversation

@davecoates
Copy link
Contributor

No description provided.

@EmilyS-AS
Copy link

EmilyS-AS commented Dec 17, 2025

I got django.db.utils.OperationalError: (1065, 'Query was empty') when trying to run tests locally

I tried this before as well, I was only able to fix it by doing

def _run_sql(self, schema_editor, sqls):
    path = Path(apps.get_app_config(self.app_name).path, 'migrations', self.filename)
    sql = path.read_text()

    statements = sqlparse.split(sql)

    for statement in statements:
        schema_editor.execute(statement)

@davecoates davecoates force-pushed the fix/runsqlfromfile-bug branch from cdb7a77 to 6646d25 Compare December 18, 2025 00:21
@davecoates davecoates merged commit 5f5e959 into master Dec 18, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments