if self.use_labels:
return column._make_proxy(self, name=column._label)
else:
- return column._make_proxy(self, name=column.key)
+ return column._make_proxy(self, name=column.name)
def append_whereclause(self, whereclause):
self._append_condition('whereclause', whereclause)
self.assert_(r==[(3, 'ed'), (4, 'wendy'), (5, 'laura')])
r = self.users.select(offset=5, order_by=[self.users.c.user_id]).execute().fetchall()
self.assert_(r==[(6, 'ralph'), (7, 'fido')])
-
+
+
def test_column_accessor(self):
self.users.insert().execute(user_id=1, user_name='john')
self.users.insert().execute(user_id=2, user_name='jack')
select([table2.c.othername, func.count(table2.c.otherid)], group_by = [table2.c.othername]),
"SELECT myothertable.othername, count(myothertable.otherid) FROM myothertable GROUP BY myothertable.othername"
)
+
+ def testoraclelimit(self):
+ e = create_engine('oracle')
+ users = Table('users', e, Column('name', String(10), key='username'))
+ self.runtest(select([users.c.username], limit=5), "SELECT name FROM (SELECT users.name AS name, ROW_NUMBER() OVER (ORDER BY users.rowid ASC) AS ora_rn FROM users) WHERE ora_rn<=5", engine=e)
+
def testgroupby_and_orderby(self):
self.runtest(
select([table2.c.othername, func.count(table2.c.otherid)], group_by = [table2.c.othername], order_by = [table2.c.othername]),