for c in columns]
if self._pending_colargs and \
isinstance(self._pending_colargs[0], Column) and \
- self._pending_colargs[0].table is not None:
+ isinstance(self._pending_colargs[0].table, Table):
self._set_parent_with_dispatch(self._pending_colargs[0].table)
def _set_parent(self, table):
elif _autoattach:
cols = sqlutil.find_columns(self.sqltext)
tables = set([c.table for c in cols
- if c.table is not None])
+ if isinstance(c.table, Table)])
if len(tables) == 1:
self._set_parent_with_dispatch(
tables.pop())
from sqlalchemy.testing import engines
from sqlalchemy.testing import eq_
from sqlalchemy.testing.assertsql import AllOf, RegexSQL, ExactSQL, CompiledSQL
+from sqlalchemy.sql import table, column
class ConstraintGenTest(fixtures.TestBase, AssertsExecutionResults):
__dialect__ = 'default'
c = Index('foo', t.c.a)
assert c in t.indexes
+ def test_auto_append_lowercase_table(self):
+ t = table('t', column('a'))
+ t2 = table('t2', column('a'))
+ for c in (
+ UniqueConstraint(t.c.a),
+ CheckConstraint(t.c.a > 5),
+ ForeignKeyConstraint([t.c.a], [t2.c.a]),
+ PrimaryKeyConstraint(t.c.a),
+ Index('foo', t.c.a)
+ ):
+ assert True
+
def test_tometadata_ok(self):
m = MetaData()