MCPcopy
hub / github.com/django/django / _run_sql

Method _run_sql

django/db/migrations/operations/special.py:125–139  ·  view source on GitHub ↗
(self, schema_editor, sqls)

Source from the content-addressed store, hash-verified

123 return "Raw SQL operation"
124
125 def _run_sql(self, schema_editor, sqls):
126 if isinstance(sqls, (list, tuple)):
127 for sql in sqls:
128 params = None
129 if isinstance(sql, (list, tuple)):
130 elements = len(sql)
131 if elements == 2:
132 sql, params = sql
133 else:
134 raise ValueError("Expected a 2-tuple but got %d" % elements)
135 schema_editor.execute(sql, params=params)
136 elif sqls != RunSQL.noop:
137 statements = schema_editor.connection.ops.prepare_sql_script(sqls)
138 for statement in statements:
139 schema_editor.execute(statement, params=None)
140
141
142class RunPython(Operation):

Callers 2

database_forwardsMethod · 0.95
database_backwardsMethod · 0.95

Calls 2

executeMethod · 0.45
prepare_sql_scriptMethod · 0.45

Tested by

no test coverage detected