MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _table_or_raise

Function _table_or_raise

lib/sqlalchemy/orm/decl_base.py:2217–2223  ·  view source on GitHub ↗
(mc: MappedClassProtocol[Any])

Source from the content-addressed store, hash-verified

2215 mapped_cls = cast("MappedClassProtocol[Any]", cls)
2216
2217 def _table_or_raise(mc: MappedClassProtocol[Any]) -> Table:
2218 if isinstance(mc.__table__, Table):
2219 return mc.__table__
2220 raise exc.InvalidRequestError(
2221 f"Cannot add a new attribute to mapped class {mc.__name__!r} "
2222 "because it's not mapped against a table."
2223 )
2224
2225 if isinstance(value, Column):
2226 _undefer_column_name(key, value)

Callers 1

_add_attributeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected