single table inheritance joins.
[ticket:2328]
+ - [bug] __table_args__ can now be passed as
+ an empty tuple as well as an empty dict.
+ [ticket:2339]. Thanks to Fayaz Yusuf Khan
+ for the patch.
+
- sql
- [bug] related to [ticket:2316], made some
adjustments to the change from [ticket:2261]
if '__table__' not in dict_:
if tablename is not None:
- if isinstance(table_args, dict):
- args, table_kw = (), table_args
- elif isinstance(table_args, tuple):
- if isinstance(table_args[-1], dict):
- args, table_kw = table_args[0:-1], table_args[-1]
- else:
- args, table_kw = table_args, {}
- else:
- args, table_kw = (), {}
+ args, table_kw = (), {}
+ if table_args:
+ if isinstance(table_args, dict):
+ table_kw = table_args
+ elif isinstance(table_args, tuple):
+ if isinstance(table_args[-1], dict):
+ args, table_kw = table_args[0:-1], table_args[-1]
+ else:
+ args = table_args
autoload = dict_.get('__autoload__')
if autoload:
assert_raises_message(sa.exc.InvalidRequestError,
'does not have a __table__', go)
+ def test_table_args_empty_dict(self):
+
+ class MyModel(Base):
+ __tablename__ = 'test'
+ id = Column(Integer, primary_key=True)
+ __table_args__ = {}
+
+ def test_table_args_empty_tuple(self):
+
+ class MyModel(Base):
+ __tablename__ = 'test'
+ id = Column(Integer, primary_key=True)
+ __table_args__ = ()
+
def test_cant_add_columns(self):
t = Table('t', Base.metadata, Column('id', Integer,
primary_key=True), Column('data', String))