[SQLObject] Default=None should do nothing.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Mike W. <li...@mi...> - 2004-07-30 18:12:13
|
Here's a problem I've run across, perhaps others have solved it: create table test ( id serial, foo varchar(20), creation_date timestamp default now() ); class Test(SQLObject): foo=StrCol(length=20, default=None) creation_date=DateTimeCol(default=None) When creating new Test objects, I do not want creation_date to be set to null; I want the database to look after setting defaults. For the time being I am passing a function creation_date=DateTimeCol(default=date.now) but that doesn't truly resolve the issue for me as I'd prefer to have the database (postgres) deal with the time stamps. This makes it easier to coexist with other apps or sql scripts directly manipulating the DB. I understand that I can use SQLBuilder to pass a db function on, but still if possible I'd prefer that somethings be handled in the background by the database, and accept that I might need to use obj.sync(), perhaps in conjunction with _lazyUpdates. Perhaps I've missed something. It won't be the last time. Mike -- Meskimen's Law: There's never time to do it right, but there's always time to do it over. |