Hi,
I had posted a message a few weeks ago about how I was having problems
inserting boolean columns into PostgreSQL and Ian thought it might have
something to do with an earlier version of Python 2.2. That was indeed the
case since I was using Python 2.2.2 on Mandrake 9.1. Of course that started a
never ending cycle upgrading various things eventually culminating in
installing Mandrake 10.0rc1 on another machine. Anyway, now I can insert but,
SQLObject always inserts a "t" regardless of whether I specify the boolean
should be true or false. Here is the code:
>>> from SQLObject import *
>>> conn = PostgresConnection('user=cilkay dbname=testdb')
>>> class Person(SQLObject):
... _connection = conn
... firstName = StringCol()
... lastName = StringCol()
... isMember = BoolCol()
...
>>> Person.createTable()
>>> p = Person.new(firstName="Donald", lastName="Duck", isMember="t")
>>> p = Person.new(firstName="Mickey", lastName="Mouse", isMember="f")
>>> p = Person.new(firstName="Minnie", lastName="Mouse", isMember="0")
>>> p = Person.new(firstName="Pluto", lastName="Dog", isMember="False")
>>> p = Person.new(firstName="Goofy", lastName="Dog", isMember="false")
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?
Regards,
Clifford Ilkay
Dinamis Corporation
3266 Yonge Street, Suite 1419
Toronto, ON M4N 3P6
Canada
Tel: 416-410-3326
|