| 523 | (False, False), (True, False), (True, True), argnames="twotable,error" |
| 524 | ) |
| 525 | def test_warn_dml(self, dml, twotable, error): |
| 526 | a, b = self.tables("table_a", "table_b") |
| 527 | |
| 528 | if dml.update: |
| 529 | stmt = update(a).values(col_a=5) |
| 530 | elif dml.delete: |
| 531 | stmt = delete(a) |
| 532 | else: |
| 533 | dml.fail() |
| 534 | |
| 535 | stmt = stmt.where(a.c.col_a == 1) |
| 536 | if twotable: |
| 537 | stmt = stmt.where(b.c.col_b == 1) |
| 538 | |
| 539 | if not error: |
| 540 | stmt = stmt.where(b.c.col_b == a.c.col_a) |
| 541 | |
| 542 | stmt_type = "UPDATE" if dml.update else "DELETE" |
| 543 | |
| 544 | with self.bind.connect() as conn: |
| 545 | if error: |
| 546 | with expect_warnings( |
| 547 | rf"{stmt_type} statement has a cartesian product between " |
| 548 | rf'FROM element\(s\) "table_[ab]" and FROM ' |
| 549 | rf'element "table_[ab]"' |
| 550 | ): |
| 551 | with self.bind.connect() as conn: |
| 552 | conn.execute(stmt) |
| 553 | else: |
| 554 | conn.execute(stmt) |
| 555 | |
| 556 | def test_no_linting(self, metadata, connection): |
| 557 | eng = engines.testing_engine( |