CHANGES
=======
+0.5.1
+========
+
+- orm
+ - Modernized the "no mapped table" exception and added a more
+ explicit __table__/__tablename__ exception to declarative.
+
- mysql
- Added the missing keywords from MySQL 4.1 so they get escaped
properly.
__all__ = sorted(name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj)))
-__version__ = '0.5.0'
+__version__ = '0.5.1'
del inspect, sys
else:
mapper_cls = mapper
+ if not table and 'inherits' not in mapper_args:
+ raise exceptions.InvalidRequestError("Class %r does not have a __table__ or __tablename__ "
+ "specified and does not inherit from an existing table-mapped class." % cls)
+
cls.__mapper__ = mapper_cls(cls, table, properties=our_stuff,
**mapper_args)
self._identity_class = self.class_
if self.mapped_table is None:
- raise sa_exc.ArgumentError("Mapper '%s' does not have a mapped_table specified. "
- "(Are you using the return value of table.create()? "
- "It no longer has a return value.)" % self)
+ raise sa_exc.ArgumentError("Mapper '%s' does not have a mapped_table specified." % self)
def _configure_extensions(self):
"""Go through the global_extensions list as well as the list
eq_(a1, Address(email='two'))
eq_(a1.user, User(name='u1'))
+ def test_no_table(self):
+ def go():
+ class User(Base):
+ id = Column('id', Integer, primary_key=True)
+ self.assertRaisesMessage(sa.exc.InvalidRequestError, "does not have a __table__", go)
+
def test_recompile_on_othermapper(self):
"""declarative version of the same test in mappers.py"""