test issue #6503
(self, legacy, threelevel)
| 304 | @testing.combinations((True,), (False,), argnames="legacy") |
| 305 | @testing.combinations((True,), (False,), argnames="threelevel") |
| 306 | def test_join_with_entities(self, legacy, threelevel): |
| 307 | """test issue #6503""" |
| 308 | |
| 309 | User, Address, Dingaling = self.classes("User", "Address", "Dingaling") |
| 310 | |
| 311 | if legacy: |
| 312 | sess = fixture_session() |
| 313 | stmt = sess.query(User).join(Address).with_entities(Address.id) |
| 314 | else: |
| 315 | stmt = select(User).join(Address).with_only_columns(Address.id) |
| 316 | |
| 317 | stmt = stmt.set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL) |
| 318 | |
| 319 | if threelevel: |
| 320 | if legacy: |
| 321 | stmt = stmt.join(Address.dingaling).with_entities(Dingaling.id) |
| 322 | else: |
| 323 | stmt = stmt.join(Address.dingaling).with_only_columns( |
| 324 | Dingaling.id |
| 325 | ) |
| 326 | |
| 327 | if threelevel: |
| 328 | self.assert_compile( |
| 329 | stmt, |
| 330 | "SELECT dingalings.id AS dingalings_id " |
| 331 | "FROM users JOIN addresses ON users.id = addresses.user_id " |
| 332 | "JOIN dingalings ON addresses.id = dingalings.address_id", |
| 333 | ) |
| 334 | else: |
| 335 | self.assert_compile( |
| 336 | stmt, |
| 337 | "SELECT addresses.id AS addresses_id FROM users " |
| 338 | "JOIN addresses ON users.id = addresses.user_id", |
| 339 | ) |
| 340 | |
| 341 | @testing.combinations((True,), (False,), argnames="legacy") |
| 342 | @testing.combinations((True,), (False,), argnames="threelevel") |
nothing calls this directly
no test coverage detected