(self, stmt_type: testing.Variation)
| 558 | |
| 559 | @testing.variation("stmt_type", ["update", "delete"]) |
| 560 | def test_dml_ctes(self, stmt_type: testing.Variation): |
| 561 | User = self.classes.User |
| 562 | |
| 563 | if stmt_type.update: |
| 564 | fn = update |
| 565 | elif stmt_type.delete: |
| 566 | fn = delete |
| 567 | else: |
| 568 | stmt_type.fail() |
| 569 | |
| 570 | inner_cte = fn(User).returning(User.id).cte("uid") |
| 571 | |
| 572 | stmt = select(inner_cte) |
| 573 | |
| 574 | if stmt_type.update: |
| 575 | self.assert_compile( |
| 576 | stmt, |
| 577 | "WITH uid AS (UPDATE users SET id=:id, name=:name " |
| 578 | "RETURNING users.id) SELECT uid.id FROM uid", |
| 579 | ) |
| 580 | elif stmt_type.delete: |
| 581 | self.assert_compile( |
| 582 | stmt, |
| 583 | "WITH uid AS (DELETE FROM users " |
| 584 | "RETURNING users.id) SELECT uid.id FROM uid", |
| 585 | ) |
| 586 | else: |
| 587 | stmt_type.fail() |
| 588 | |
| 589 | @testing.variation("stmt_type", ["core", "orm"]) |
| 590 | def test_aliased_update(self, stmt_type: testing.Variation): |
nothing calls this directly
no test coverage detected