MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _ColumnMapping

Class _ColumnMapping

lib/sqlalchemy/orm/mapper.py:4420–4440  ·  view source on GitHub ↗

Error reporting helper for mapper._columntoproperty.

Source from the content-addressed store, hash-verified

4418
4419
4420class _ColumnMapping(Dict["ColumnElement[Any]", "MapperProperty[Any]"]):
4421 """Error reporting helper for mapper._columntoproperty."""
4422
4423 __slots__ = ("mapper",)
4424
4425 def __init__(self, mapper):
4426 # TODO: weakref would be a good idea here
4427 self.mapper = mapper
4428
4429 def __missing__(self, column):
4430 prop = self.mapper._props.get(column)
4431 if prop:
4432 raise orm_exc.UnmappedColumnError(
4433 "Column '%s.%s' is not available, due to "
4434 "conflicting property '%s':%r"
4435 % (column.table.name, column.name, column.key, prop)
4436 )
4437 raise orm_exc.UnmappedColumnError(
4438 "No column %s is configured on mapper %s..."
4439 % (column, self.mapper)
4440 )

Callers 1

_configure_propertiesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected