At 06:14 10/03/2004 -0500, Chris Gahan wrote:
>Ian answered your first question, so I'll field the second one. :)
>
>"Clifford Ilkay" <cli...@di...> wrote in message
>news:200403091343.17553.clifford_ilkay at dinamis.com...
> > testdb=# select * from person;
> > id | last_name | is_member | first_name
> > ----+-----------+-----------+------------
> > 1 | Duck | t | Donald
> > 2 | Mouse | t | Mickey
> > 3 | Mouse | t | Minnie
> > 4 | Dog | t | Pluto
> > 5 | Dog | t | Goofy
> > (5 rows)
> >
> > As you can see, I tried various ways of expressing "False" but none of
>them
> > seemed to work. What am I missing? Also, why is the order of the columns
>not
> > the same as the order that was specified in the class definition?
>
>I haven't looked this up, but this is probably what's happening:
>
>When you create a subclass of an SQLObject, you're creating a new python
>object. To create the table, SQLObject has to inspect this python object's
>attributes to see which of them are Col() classes. Now, internally, python
>stores all the attributes of a class in a dict(), so that when you look up
>an attribute, it just does a lookup in the dict(). The reason they're out of
>order is that dictionaries don't maintain any kind of order. The order of
>the things in a dictionary depends on the order you inserted them. So,
>basically, either SQLObject would have to pre-sort the dictionary, or it
>would have to be psychic.
Hi Chris,
Thanks for explaining that. It is not a big deal for me since I do not
intend to use SQLObject to create the tables anyway. I have a SQL script
that I use to do that. Since one has to specify the columns/attributes in
the new() method anyway, the order of columns makes no difference.
Regards,
Clifford Ilkay
Dinamis Corporation
3266 Yonge Street, Suite 1419
Toronto, Ontario
Canada M4N 3P6
Tel: 416-410-3326
|