Commits

Mike Bayer  committed bb755bf

tweak for Table.create() not having a return value

  • Participants
  • Parent commits 0f43fe0

Comments (0)

Files changed (2)

File examples/vertical/vertical.py

 entities = Table('entities', e, 
     Column('entity_id', Integer, primary_key=True),
     Column('title', String(100), nullable=False),
-    ).create()
+    )
 
 # this table represents dynamic fields that can be associated
 # with values attached to an Entity.
 entity_fields = Table('entity_fields', e,
     Column('field_id', Integer, primary_key=True),
     Column('name', String(40), nullable=False),
-    Column('datatype', String(30), nullable=False)).create()
+    Column('datatype', String(30), nullable=False))
     
 # this table represents attributes that are attached to an 
 # Entity object.  It combines a row from entity_fields with an actual value.
     Column('int_value', Integer), 
     Column('string_value', String(500)),
     Column('binary_value', PickleType),
-    Column('datetime_value', DateTime)).create()
+    Column('datetime_value', DateTime))
+
+e.create_all()
 
 class EntityDict(dict):
     """this is a dictionary that implements an append() and an __iter__ method.

File lib/sqlalchemy/orm/mapper.py

             self.mapped_table = self.local_table
             if self.polymorphic_identity is not None:
                 self._add_polymorphic_mapping(self.polymorphic_identity, self)
-                
+
+        if self.mapped_table is None:
+            raise exceptions.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.)" % str(self))
+            
         # convert polymorphic class associations to mappers
         for key in self.polymorphic_map.keys():
             if isinstance(self.polymorphic_map[key], type):