[sqlalchemy] Re: order_by strangeness

2006-10-19 Thread GeoffL

Hi Mike,

My first two attempts to get a little test case have not had any
problems.  It might be a while before I manage to get something that
shows up the problem.

cheers,
Geoff


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: order_by strangeness

2006-10-17 Thread GeoffL

Thanks Michael,

I'll make a test case if I get some time this (NZ) evening.  SQL
echoing is on, and what it's doing seems to make sense, though I'll
check that on the test case.  This is with PostgreSQL so old sqlite
gotchas won't apply.  At the moment I wouldn't rule out that I'm doing
something silly.

Thanks for such a great tool!

cheers,
Geoff


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] order_by strangeness

2006-10-17 Thread GeoffL

Hi,

I'm using SQLAlchemy 0.28 with Pylons 0.98, and when I define this
structure (abridged, so I'm not sure it will really compile...)

people_table = Table("people", metadata,
Column('id', Integer, primary_key=True),
Column('user_name', String),
Column('first_name', String),
Column('last_name', String),
Column('password', String)
)

phone_numbers_table = Table("phone_numbers", metadata,
Column('id', Integer, primary_key=True),
Column('person_id', Integer, ForeignKey('people.id')),
Column('is_alert_number', Boolean),
Column('type', String),
Column('number', String)
)

class Person(object):
pass

class PhoneNumber(object):
pass

person_mapper = mapper(Person, people_table,
properties = {
'phones' : relation(PhoneNumber, cascade="all, delete-orphan",
backref="person", order_by=desc("is_alert_number"))
})

phone_mapper = mapper(PhoneNumber, phone_numbers_table)


and then do the following with a person:

for n in a_person.phones:
print n.number, n.is_alert_number


I get inconsistent results - at times just about anything can change -
usually the results are right but about one time in three the
is_alert_number is wrong, and occasionally not all the numbers are
listed or the order changes.  Removing the "order_by" seems to fix
things.

I've looked through the bug list on Trac, and I've looked through the
group and nothing like this has jumped out at me.  Are you interested
and should I try to get a real simplified test case?

cheers,
Geoff


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---