(self)
| 432 | is_true(coerced.compare(stmt.scalar_subquery().label(None))) |
| 433 | |
| 434 | def test_scalar_select(self): |
| 435 | with testing.expect_warnings( |
| 436 | "implicitly coercing SELECT object to scalar subquery" |
| 437 | ): |
| 438 | self.assert_compile( |
| 439 | func.coalesce(select(self.table1.c.myid)), |
| 440 | "coalesce((SELECT mytable.myid FROM mytable))", |
| 441 | ) |
| 442 | |
| 443 | with testing.expect_warnings( |
| 444 | "implicitly coercing SELECT object to scalar subquery" |
| 445 | ): |
| 446 | s = select(self.table1.c.myid).alias() |
| 447 | self.assert_compile( |
| 448 | select(self.table1.c.myid).where(self.table1.c.myid == s), |
| 449 | "SELECT mytable.myid FROM mytable WHERE " |
| 450 | "mytable.myid = (SELECT mytable.myid FROM " |
| 451 | "mytable)", |
| 452 | ) |
| 453 | |
| 454 | with testing.expect_warnings( |
| 455 | "implicitly coercing SELECT object to scalar subquery" |
| 456 | ): |
| 457 | self.assert_compile( |
| 458 | select(self.table1.c.myid).where(s > self.table1.c.myid), |
| 459 | "SELECT mytable.myid FROM mytable WHERE " |
| 460 | "mytable.myid < (SELECT mytable.myid FROM " |
| 461 | "mytable)", |
| 462 | ) |
| 463 | |
| 464 | with testing.expect_warnings( |
| 465 | "implicitly coercing SELECT object to scalar subquery" |
| 466 | ): |
| 467 | s = select(self.table1.c.myid).alias() |
| 468 | self.assert_compile( |
| 469 | select(self.table1.c.myid).where(self.table1.c.myid == s), |
| 470 | "SELECT mytable.myid FROM mytable WHERE " |
| 471 | "mytable.myid = (SELECT mytable.myid FROM " |
| 472 | "mytable)", |
| 473 | ) |
| 474 | |
| 475 | with testing.expect_warnings( |
| 476 | "implicitly coercing SELECT object to scalar subquery" |
| 477 | ): |
| 478 | self.assert_compile( |
| 479 | select(self.table1.c.myid).where(s > self.table1.c.myid), |
| 480 | "SELECT mytable.myid FROM mytable WHERE " |
| 481 | "mytable.myid < (SELECT mytable.myid FROM " |
| 482 | "mytable)", |
| 483 | ) |
| 484 | |
| 485 | @testing.fixture() |
| 486 | def update_from_fixture(self): |
nothing calls this directly
no test coverage detected