sqlalchemy_utils.get_mapper

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

32 Examples 7

Example 1

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, Building):
        alias = sa.orm.aliased(Building.__table__)
        assert (
            get_mapper(alias) ==
            sa.inspect(Building)
        )

Example 2

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper_entity_with_mapper(self, session, Building):
        entity = session.query(Building.__mapper__)._entities[0]
        assert (
            get_mapper(entity) ==
            sa.inspect(Building)
        )

Example 3

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper_entity_with_class(self, session, Building):
        entity = session.query(Building)._entities[0]
        assert (
            get_mapper(entity) ==
            sa.inspect(Building)
        )

Example 4

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, Building):
        alias = sa.orm.aliased(Building.__table__)
        assert (
            get_mapper(alias) ==
            sa.inspect(Building)
        )

Example 5

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper_entity_with_mapper(self, session, Building):
        entity = session.query(Building.__mapper__)._entities[0]
        assert (
            get_mapper(entity) ==
            sa.inspect(Building)
        )

Example 6

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper_entity_with_class(self, session, Building):
        entity = session.query(Building)._entities[0]
        assert (
            get_mapper(entity) ==
            sa.inspect(Building)
        )

Example 7

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, Building):
        assert get_mapper(Building.__table__) == sa.inspect(Building)

Example 8

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_declarative_class(self, Building):
        assert (
            get_mapper(Building) ==
            sa.inspect(Building)
        )

Example 9

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_declarative_object(self, Building):
        assert (
            get_mapper(Building()) ==
            sa.inspect(Building)
        )

Example 10

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper(self, Building):
        assert (
            get_mapper(Building.__mapper__) ==
            sa.inspect(Building)
        )

Example 11

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_class_alias(self, Building):
        assert (
            get_mapper(sa.orm.aliased(Building)) ==
            sa.inspect(Building)
        )

Example 12

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_instrumented_attribute(self, Building):
        assert (
            get_mapper(Building.id) == sa.inspect(Building)
        )

Example 13

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column(self, Building):
        assert (
            get_mapper(Building.__table__.c.id) ==
            sa.inspect(Building)
        )

Example 14

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column_of_an_alias(self, Building):
        assert (
            get_mapper(sa.orm.aliased(Building.__table__).c.id) ==
            sa.inspect(Building)
        )

Example 15

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column_entity(self, session, Building):
        query = session.query(Building.id)
        assert get_mapper(query._entities[0]) == sa.inspect(Building)

Example 16

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, Building):
        assert get_mapper(Building.__table__) == sa.inspect(Building)

Example 17

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, Building):
        with pytest.raises(ValueError):
            get_mapper(Building.__table__)

Example 18

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_declarative_class(self, Building):
        assert (
            get_mapper(Building) ==
            sa.inspect(Building)
        )

Example 19

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, Building):
        alias = sa.orm.aliased(Building.__table__)
        with pytest.raises(ValueError):
            get_mapper(alias)

Example 20

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_declarative_object(self, Building):
        assert (
            get_mapper(Building()) ==
            sa.inspect(Building)
        )

Example 21

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_mapper(self, Building):
        assert (
            get_mapper(Building.__mapper__) ==
            sa.inspect(Building)
        )

Example 22

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_class_alias(self, Building):
        assert (
            get_mapper(sa.orm.aliased(Building)) ==
            sa.inspect(Building)
        )

Example 23

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_instrumented_attribute(self, Building):
        assert (
            get_mapper(Building.id) == sa.inspect(Building)
        )

Example 24

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column(self, Building):
        assert (
            get_mapper(Building.__table__.c.id) ==
            sa.inspect(Building)
        )

Example 25

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column_of_an_alias(self, Building):
        assert (
            get_mapper(sa.orm.aliased(Building.__table__).c.id) ==
            sa.inspect(Building)
        )

Example 26

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, building):
        with pytest.raises(ValueError):
            get_mapper(building)

Example 27

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, building):
        alias = sa.orm.aliased(building)
        with pytest.raises(ValueError):
            get_mapper(alias)

Example 28

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_column_entity(self, session, Building):
        query = session.query(Building.id)
        assert get_mapper(query._entities[0]) == sa.inspect(Building)

Example 29

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, Building):
        with pytest.raises(ValueError):
            get_mapper(Building.__table__)

Example 30

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, Building):
        alias = sa.orm.aliased(Building.__table__)
        with pytest.raises(ValueError):
            get_mapper(alias)

Example 31

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table(self, building):
        with pytest.raises(ValueError):
            get_mapper(building)

Example 32

Project: sqlalchemy-utils
Source File: test_get_mapper.py
View license
    def test_table_alias(self, building):
        alias = sa.orm.aliased(building)
        with pytest.raises(ValueError):
            get_mapper(alias)