that includes a remote schema to a *different* schema
than that of the parent table doesn't render at all,
as cross-schema references do not appear to be supported.
+
+- declarative
+ - An error is raised if __table_args__ is not in tuple
+ or dict format, and is not None. [ticket:1972]
0.6.5
=====
isinstance(obj, declarative_props)
):
table_args = cls.__table_args__
+ if not isinstance(table_args, (tuple, dict, type(None))):
+ raise exceptions.ArgumentError(
+ "__table_args__ value must be a tuple, "
+ "dict, or None")
if base is not cls:
inherited_table_args = True
elif class_mapped:
'Mapper Mapper|User|users could not '
'assemble any primary key', define)
- def test_table_args(self):
+ def test_table_args_bad_format(self):
def err():
class Foo1(Base):
assert_raises_message(sa.exc.ArgumentError,
'Tuple form of __table_args__ is ', err)
+
+ def test_table_args_type(self):
+ def err():
+ class Foo1(Base):
+
+ __tablename__ = 'foo'
+ __table_args__ = ForeignKeyConstraint(['id'], ['foo.id'
+ ])
+ id = Column('id', Integer, primary_key=True)
+ assert_raises_message(sa.exc.ArgumentError,
+ '__table_args__ value must be a tuple, ', err)
+
+ def test_table_args_none(self):
+
+ class Foo2(Base):
+ __tablename__ = 'foo'
+ __table_args__ = None
+ id = Column('id', Integer, primary_key=True)
+
+ assert Foo2.__table__.kwargs == {}
+
+ def test_table_args_dict_format(self):
+
class Foo2(Base):
__tablename__ = 'foo'
assert Foo2.__table__.kwargs['mysql_engine'] == 'InnoDB'
+ def test_table_args_tuple_format(self):
+ class Foo2(Base):
+
+ __tablename__ = 'foo'
+ __table_args__ = {'mysql_engine': 'InnoDB'}
+ id = Column('id', Integer, primary_key=True)
+
class Bar(Base):
__tablename__ = 'bar'