self.constraints = set()
self._columns = expression.ColumnCollection()
self._set_primary_key(PrimaryKeyConstraint())
- self.foreign_keys = util.OrderedSet()
+ self.foreign_keys = set()
self._extra_dependencies = set()
self.kwargs = {}
if self.schema is not None:
self.onupdate = kwargs.pop('onupdate', None)
self.autoincrement = kwargs.pop('autoincrement', True)
self.constraints = set()
- self.foreign_keys = util.OrderedSet()
+ self.foreign_keys = set()
self._table_events = set()
# check if this Column is proxying another column
if self.key in table._columns:
col = table._columns.get(self.key)
- for fk in col.foreign_keys:
+ for fk in list(col.foreign_keys):
col.foreign_keys.remove(fk)
table.foreign_keys.remove(fk)
if fk.constraint in table.constraints:
self.primary_key = ColumnSet()
self.foreign_keys = set()
- def _export_columns(self):
- """Initialize column collections."""
-
- self._columns = ColumnCollection()
- self._primary_key = ColumnSet()
- self._foreign_keys = set()
- self._populate_column_collection()
-
def _populate_column_collection(self):
pass
def _init_collections(self):
pass
- def _export_columns(self):
- raise NotImplementedError()
-
@util.memoized_property
def description(self):
# Py3K
for left in (a_subset, a):
if left is None:
continue
- for fk in b.foreign_keys:
+ for fk in sorted(
+ b.foreign_keys,
+ key=lambda fk:fk.parent._creation_order):
try:
col = fk.get_referent(left)
except exc.NoReferencedTableError:
crit.append(col == fk.parent)
constraints.add(fk.constraint)
if left is not b:
- for fk in left.foreign_keys:
+ for fk in sorted(
+ left.foreign_keys,
+ key=lambda fk:fk.parent._creation_order):
try:
col = fk.get_referent(b)
except exc.NoReferencedTableError:
if len(crit) == 0:
if isinstance(b, expression._FromGrouping):
- hint = " Perhaps you meant to convert the right side to a subquery using alias()?"
+ hint = " Perhaps you meant to convert the right side to a "\
+ "subquery using alias()?"
else:
hint = ""
raise exc.ArgumentError(
# using sqlite3 the C extension took it back up to approx. 1257
# (py2.6)
- @profiling.function_call_count(1067,
+ @profiling.function_call_count(1005,
versions={'2.5':1050, '2.6':1050,
'2.6+cextension':1041,
'2.4': 763}
metadata.drop_all()
@profiling.function_call_count(14416, versions={'2.4': 13214,
- '2.6+cextension': 385,
- '2.7+cextension':401})
+ '2.6+cextension': 345,
+ '2.7+cextension':345})
def test_string(self):
[tuple(row) for row in t.select().execute().fetchall()]
# sqlite3 returns native unicode. so shouldn't be an increase here.
@profiling.function_call_count(14396, versions={'2.4': 13214,
- '2.6+cextension': 385,
- '2.7+cextension':385})
+ '2.6+cextension': 345,
+ '2.7+cextension':345})
def test_unicode(self):
[tuple(row) for row in t2.select().execute().fetchall()]
# ensure initial connect activities complete
e.execute("select 1")
- @profiling.function_call_count(59, versions={'2.4':41, '2.5':58,
- '2.6':58, '3':57},
+ @profiling.function_call_count(56, versions={'2.4':41, '2.5':58,
+ '2.6':58, '3':57,
+ '2.6+cextension':56},
variance=.05)
def go():
e.execute("select 1")
def test_profile_2_insert(self):
self.test_baseline_2_insert()
- @profiling.function_call_count(3596, {'2.4': 2158})
+ @profiling.function_call_count(3340, {'2.4': 2158, '2.7':3564, '2.6':3564})
def test_profile_3_properties(self):
self.test_baseline_3_properties()
@profiling.function_call_count(11624, {'2.4': 7963, '2.6+cextension'
- : 12447, '2.7+cextension': 12447},
+ : 10736, '2.7+cextension': 10736},
variance=0.10)
def test_profile_4_expressions(self):
self.test_baseline_4_expressions()
'2.6': 6058,
'2.7': 5922,
'2.7+cextension': 5714,
- '2.6+cextension': 6058,
+ '2.6+cextension': 5714,
})
def test_profile_3_properties(self):
self.test_baseline_3_properties()
# case
sa.orm.configure_mappers()
- eq_(str(Address.user_id.property.columns[0].foreign_keys[0]),
+ eq_(str(list(Address.user_id.property.columns[0].foreign_keys)[0]),
"ForeignKey('users.id')")
Base.metadata.create_all()
u1 = User(name='u1', addresses=[Address(email='one'),