MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _table_or_raise

Function _table_or_raise

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

Source from the content-addressed store, hash-verified

2115 mapped_cls = cast("MappedClassProtocol[Any]", cls)
2116
2117 def _table_or_raise(mc: MappedClassProtocol[Any]) -> Table:
2118 if isinstance(mc.__table__, Table):
2119 return mc.__table__
2120 raise exc.InvalidRequestError(
2121 f"Cannot add a new attribute to mapped class {mc.__name__!r} "
2122 "because it's not mapped against a table."
2123 )
2124
2125 if isinstance(value, Column):
2126 _undefer_column_name(key, value)

Callers 1

_add_attributeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected