(self)
| 567 | ) |
| 568 | |
| 569 | def test_baked_mix(self): |
| 570 | sess = self._fixture_data() |
| 571 | |
| 572 | tokyo = sess.query(WeatherLocation).filter_by(city="Tokyo").one() |
| 573 | tokyo.city |
| 574 | sess.expunge_all() |
| 575 | |
| 576 | from sqlalchemy.ext.baked import BakedQuery |
| 577 | |
| 578 | bakery = BakedQuery.bakery() |
| 579 | |
| 580 | def get_tokyo(sess): |
| 581 | bq = bakery(lambda session: session.query(WeatherLocation)) |
| 582 | t = bq(sess).get(tokyo.id) |
| 583 | return t |
| 584 | |
| 585 | Sess = sessionmaker(class_=Session, bind=db2, autoflush=True) |
| 586 | sess2 = Sess() |
| 587 | |
| 588 | t = get_tokyo(sess) |
| 589 | eq_(t.city, tokyo.city) |
| 590 | |
| 591 | t = get_tokyo(sess2) |
| 592 | eq_(t.city, tokyo.city) |
| 593 | |
| 594 | @testing.combinations( |
| 595 | "fetch", "evaluate", "auto", argnames="synchronize_session" |
nothing calls this directly
no test coverage detected