11 messages in com.googlegroups.sqlalchemy[sqlalchemy] Default value for object...| From | Sent On | Attachments |
|---|---|---|
| Jonathan Ballet | 30 Jul 2007 08:50 | |
| Michael Bayer | 30 Jul 2007 10:36 | |
| Jonathan Ballet | 30 Jul 2007 11:26 | |
| sdob...@sistechnology.com | 30 Jul 2007 12:15 | |
| Michael Bayer | 30 Jul 2007 13:33 | |
| Paul Johnston | 30 Jul 2007 16:29 | |
| Jonathan Ballet | 31 Jul 2007 01:11 | |
| Michael Bayer | 31 Jul 2007 07:35 | |
| Paul Johnston | 31 Jul 2007 08:30 | |
| Michael Bayer | 31 Jul 2007 09:26 | |
| Paul Johnston | 01 Aug 2007 13:23 |
| Subject: | [sqlalchemy] Default value for objects' attributes![]() |
|---|---|
| From: | Jonathan Ballet (mult...@free.fr) |
| Date: | 07/30/2007 08:50:48 AM |
| List: | com.googlegroups.sqlalchemy |
Hi,
we ran into a small problem today, related to default values for table's columns. Here an example :
test = Table('test', metadata, Column('id', Integer, primary_key=True), Column('test_value', Boolean, default=False, nullable=False) ) class Test(object):pass test_mapper = mapper(Test, test)
metadata is a bound metadata connected on a PostgreSQL (8.1) database.
The problem is that creating a new object from class Test doesn't set the default value for attributes :
t = Test() print t.test_value
None
(However, the default value is used just before inserting the object in the database, which is fine).
Is there an easy way to have attributes set to there default values, instead of None ?
Thanks, - Jonathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




