On Tue, Dec 27, 2011 at 16:42, Michael Bayer <mike...@zzzcomputing.com> wrote:
>
> On Dec 27, 2011, at 10:37 AM, VDK wrote:
>
>> Michael,
>>
>> I simplified my code just for test purposes. I'm now working with only
>> two columns, without order_by clause, commented a few other lines with
>> order by. I'm sure there is no order_by left in my code. I run the
>> script with echo set to debug. The result:
>>
>> INFO:sqlalchemy.engine.base.Engine.0x...a7d0:{}
>> DEBUG:sqlalchemy.engine.base.Engine.0x...a7d0:Col
>> ('contributie_alle_leden_id', 'contributie_alle_leden_achternaam')
>> 2011-12-27 16:23:05,839 INFO sqlalchemy.engine.base.Engine.0x...a7d0
>> SELECT contributie_alle_leden.id AS contributie_alle_leden_id,
>> contributie_alle_leden.achternaam AS
>> contributie_alle_leden_achternaam
>> FROM (SELECT "Leden".id AS id, "Leden".achternaam AS achternaam
>> FROM "Leden") AS contributie_alle_leden ORDER BY
>> contributie_alle_leden.id
>>
>> The order by is still added. As sqlalchemy doesn't add things, the
>> only suspect now is elixir. This is part of the Camelot framework and
>> act as a layer upon SQLAlchemy.
>
> *elixir* - I just searched your other emails and it appears they fail to 
> mention this extremely critical detail.   Elixir adds default order_bys.   
> You need to use elixir's configuration flags to disable that.

Hey! Elixir is clearly not perfect, but that one was uncalled for
because Elixir *does not* add default order_bys (unless you tell it
to, of course). So it is either Camelot's fault or the user code.

In [1]: from elixir import *

In [2]: class A(Entity):
   ...:     name = Field(String(20))
   ...:

In [3]: metadata.bind = 'sqlite://'

In [4]: metadata.bind.echo = True

In [5]: setup_all(True)
2012-01-09 09:53:08,694 INFO sqlalchemy.engine.base.Engine PRAGMA table_info("__
main___a")
2012-01-09 09:53:08,696 INFO sqlalchemy.engine.base.Engine ()
2012-01-09 09:53:08,698 INFO sqlalchemy.engine.base.Engine
CREATE TABLE __main___a (
        id INTEGER NOT NULL,
        name VARCHAR(20),
        PRIMARY KEY (id)
)


2012-01-09 09:53:08,700 INFO sqlalchemy.engine.base.Engine ()
2012-01-09 09:53:08,704 INFO sqlalchemy.engine.base.Engine COMMIT

In [6]: A.query.all()
2012-01-09 09:53:15,782 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2012-01-09 09:53:15,783 INFO sqlalchemy.engine.base.Engine SELECT __main___a.id
AS __main___a_id, __main___a.name AS __main___a_name
FROM __main___a
2012-01-09 09:53:15,786 INFO sqlalchemy.engine.base.Engine ()
Out[6]: []

> I think this email thread is going to become the textbook example of why we 
> took out default order by, the next time someone asks.

-- 
Gaëtan de Menten

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to