Create the SQL for this query. Return the SQL string and list of parameters.
(self)
| 2231 | |
| 2232 | class SQLAggregateCompiler(SQLCompiler): |
| 2233 | def as_sql(self): |
| 2234 | """ |
| 2235 | Create the SQL for this query. Return the SQL string and list of |
| 2236 | parameters. |
| 2237 | """ |
| 2238 | sql, params = [], [] |
| 2239 | for annotation in self.query.annotation_select.values(): |
| 2240 | ann_sql, ann_params = self.compile(annotation) |
| 2241 | ann_sql, ann_params = annotation.select_format(self, ann_sql, ann_params) |
| 2242 | sql.append(ann_sql) |
| 2243 | params.extend(ann_params) |
| 2244 | self.col_count = len(self.query.annotation_select) |
| 2245 | sql = ", ".join(sql) |
| 2246 | params = tuple(params) |
| 2247 | |
| 2248 | inner_query_sql, inner_query_params = self.query.inner_query.get_compiler( |
| 2249 | self.using, |
| 2250 | elide_empty=self.elide_empty, |
| 2251 | ).as_sql(with_col_aliases=True) |
| 2252 | sql = "SELECT %s FROM (%s) subquery" % (sql, inner_query_sql) |
| 2253 | params += inner_query_params |
| 2254 | return sql, params |
| 2255 | |
| 2256 | |
| 2257 | def cursor_iter(cursor, sentinel, col_count, itersize): |
nothing calls this directly
no test coverage detected