>> When _offset is 0 or None, _limit seems to be ignored. There might be >> something else but I see: >> >> print q[:0] # no limit statement in the SQL >> print q[0:0] # no limit statement in the SQL >> print q[1:1] # limit statement is there > > the first two have a LIMIT of zero. Did you try: > > print q[0:10] ?
I attach a test case. In here, it prints: ------------------------------ ** q[:0] SELECT users.id AS users_id, users.name AS users_name FROM users ORDER BY users.id ** q[0:0] SELECT users.id AS users_id, users.name AS users_name FROM users ORDER BY users.id ** q[1:1] SELECT users.id AS users_id, users.name AS users_name FROM users ORDER BY users.id LIMIT 0 OFFSET 1 ** q[0:10] SELECT users.id AS users_id, users.name AS users_name FROM users ORDER BY users.id LIMIT 10 OFFSET 0 ------------------------------ Shouldn't the first two feature " LIMIT 0 OFFSET 1"? I'm running alchemy 0.4.5 -- Yannick Gingras --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
from sqlalchemy import * from sqlalchemy.orm import relation, backref, create_session from sqlalchemy.orm import scoped_session, sessionmaker engine = create_engine("sqlite:///") db_sess = scoped_session(sessionmaker(autoflush=True, transactional=True, bind=engine)) mapper = db_sess.mapper meta = MetaData() users_table = Table('users', meta, Column('id', Integer, primary_key=True), Column('name', Unicode, nullable=False, unique=True), ) class User(object): pass mapper(User, users_table) meta.create_all(bind=engine) for name in [u"john", u"bob", u"jim", u"joe"]: User(name=name) db_sess.commit() q = User.query() print "\n\n** q[:0]" print q[:0] print "\n\n** q[0:0]" print q[0:0] print "\n\n** q[1:1]" print q[1:1] print "\n\n** q[0:10]" print q[0:10]