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

Method sql

tortoise/queryset.py:298–312  ·  view source on GitHub ↗

Returns the SQL query that will be executed. By default, it will return the query with placeholders, but if you set `params_inline=True`, it will inline the parameters. :param params_inline: Whether to inline the parameters

(self, params_inline=False)

Source from the content-addressed store, hash-verified

296 return any(info.term.is_aggregate for info in annotation_info.values())
297
298 def sql(self, params_inline=False) -> str:
299 """
300 Returns the SQL query that will be executed. By default, it will return the query with
301 placeholders, but if you set `params_inline=True`, it will inline the parameters.
302
303 :param params_inline: Whether to inline the parameters
304 """
305 self._choose_db_if_not_chosen()
306
307 self._make_query()
308 if params_inline:
309 sql = self.query.get_sql()
310 else:
311 sql, _ = self.query.get_parameterized_sql()
312 return sql
313
314 def _make_query(self) -> None:
315 raise NotImplementedError() # pragma: nocoverage

Callers 15

test_filterFunction · 0.45
test_group_byFunction · 0.45
test_annotateFunction · 0.45
test_valuesFunction · 0.45
test_values_listFunction · 0.45
test_existsFunction · 0.45
test_countFunction · 0.45
test_updateFunction · 0.45

Calls 4

_make_queryMethod · 0.95
get_parameterized_sqlMethod · 0.80
get_sqlMethod · 0.45

Tested by 15

test_filterFunction · 0.36
test_group_byFunction · 0.36
test_annotateFunction · 0.36
test_valuesFunction · 0.36
test_values_listFunction · 0.36
test_existsFunction · 0.36
test_countFunction · 0.36
test_updateFunction · 0.36