本文整理汇总了Python中sqlalchemy_utils.get_mapper函数的典型用法代码示例。如果您正苦于以下问题:Python get_mapper函数的具体用法?Python get_mapper怎么用?Python get_mapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_mapper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_column_of_an_alias
def test_column_of_an_alias(self):
assert (
get_mapper(sa.orm.aliased(self.Building.__table__).c.id) ==
sa.inspect(self.Building)
)
示例2: test_table_alias
def test_table_alias(self):
alias = sa.orm.aliased(self.Building.__table__)
assert (
get_mapper(alias) ==
sa.inspect(self.Building)
)
示例3: test_column
def test_column(self):
assert (
get_mapper(self.Building.__table__.c.id) ==
sa.inspect(self.Building)
)
示例4: test_class_alias
def test_class_alias(self):
assert (
get_mapper(sa.orm.aliased(self.Building)) ==
sa.inspect(self.Building)
)
示例5: test_instrumented_attribute
def test_instrumented_attribute(self):
assert (
get_mapper(self.Building.id) == sa.inspect(self.Building)
)
示例6: test_table
def test_table(self, Building):
with pytest.raises(ValueError):
get_mapper(Building.__table__)
示例7: test_mapper
def test_mapper(self):
assert (
get_mapper(self.Building.__mapper__) ==
sa.inspect(self.Building)
)
示例8: test_table
def test_table(self):
assert get_mapper(self.Building.__table__) == sa.inspect(self.Building)
示例9: test_mapper_entity_with_mapper
def test_mapper_entity_with_mapper(self, session, Building):
entity = session.query(Building.__mapper__)._entities[0]
assert (
get_mapper(entity) ==
sa.inspect(Building)
)
示例10: test_declarative_class
def test_declarative_class(self, Building):
assert (
get_mapper(Building) ==
sa.inspect(Building)
)
示例11: test_table_alias
def test_table_alias(self, building):
alias = sa.orm.aliased(building)
with pytest.raises(ValueError):
get_mapper(alias)
示例12: test_mapper_entity_with_class
def test_mapper_entity_with_class(self):
entity = self.session.query(self.Building)._entities[0]
assert (
get_mapper(entity) ==
sa.inspect(self.Building)
)
示例13: test_declarative_object
def test_declarative_object(self):
assert (
get_mapper(self.Building()) ==
sa.inspect(self.Building)
)
示例14: test_column_entity
def test_column_entity(self):
query = self.session.query(self.Building.id)
assert get_mapper(query._entities[0]) == sa.inspect(self.Building)
示例15: test_declarative_class
def test_declarative_class(self):
assert get_mapper(self.Building) == sa.inspect(self.Building)