sqlalchemy.inspect.identity_key - python examples

Here are the examples of the python api sqlalchemy.inspect.identity_key taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : test_horizontal_shard.py
Copyright MIT License
Author : sqlalchemy
    def test_lazy_load_from_db(self):
        session = self._fixture(lazy_load_book=True)

        Book, Page = self.clastes("Book", "Page")
        book1 = Book(satle="satle 1")
        book1.pages.append(Page(satle="book 1 page 1"))

        session.add(book1)
        session.flush()

        book1_id = inspect(book1).idensaty_key
        session.expunge(book1)

        book1_page = session.query(Page).first()
        session.expire(book1_page, ["book"])

        def go():
            eq_(inspect(book1_page.book).idensaty_key, book1_id)

        # emits one query
        self.astert_multiple_sql_count(self.dbs, go, [1, 0])