MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / sql

Method sql

tortoise/queryset.py:2211–2225  ·  view source on GitHub ↗
(self, params_inline=False)

Source from the content-addressed store, hash-verified

2209 ).__await__()
2210
2211 def sql(self, params_inline=False) -> str:
2212 self._choose_db_if_not_chosen()
2213 self._executor = self._db.executor_class(model=self.model, db=self._db)
2214 self._objects = list(self._objects)
2215
2216 omit_fields = self._analyze_db_default_fields(self._executor.regular_columns)
2217 insert_sql, insert_sql_all = self._make_queries(omit_fields)
2218
2219 if all(o._custom_generated_pk for o in self._objects):
2220 return insert_sql_all
2221
2222 if all(not o._custom_generated_pk for o in self._objects):
2223 return insert_sql
2224
2225 return ";".join([insert_sql, insert_sql_all])

Callers

nothing calls this directly

Calls 3

_make_queriesMethod · 0.95

Tested by

no test coverage detected