(self, style)
| 1182 | |
| 1183 | @testing.variation("style", ["inline", "within_group"]) |
| 1184 | def test_aggregate_order_by_two(self, style): |
| 1185 | table = Table( |
| 1186 | "table1", MetaData(), Column("a", Integer), Column("b", Integer) |
| 1187 | ) |
| 1188 | expr = func.string_agg( |
| 1189 | table.c.a, literal_column("','") |
| 1190 | ).aggregate_order_by(table.c.a) |
| 1191 | stmt = select(expr) |
| 1192 | |
| 1193 | if style.within_group: |
| 1194 | dialect = default.DefaultDialect() |
| 1195 | dialect.aggregate_order_by_style = ( |
| 1196 | AggregateOrderByStyle.WITHIN_GROUP |
| 1197 | ) |
| 1198 | self.assert_compile( |
| 1199 | stmt, |
| 1200 | "SELECT string_agg(table1.a, ',') " |
| 1201 | "WITHIN GROUP (ORDER BY table1.a) " |
| 1202 | "AS string_agg_1 FROM table1", |
| 1203 | dialect=dialect, |
| 1204 | ) |
| 1205 | else: |
| 1206 | self.assert_compile( |
| 1207 | stmt, |
| 1208 | "SELECT string_agg(table1.a, ',' ORDER BY table1.a) " |
| 1209 | "AS string_agg_1 FROM table1", |
| 1210 | ) |
| 1211 | |
| 1212 | def test_aggregate_order_by_multi_col(self): |
| 1213 | table = Table( |
nothing calls this directly
no test coverage detected