On 5/16/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Wed, May 16, 2007 at 08:36:00PM +0800, ro wrote:
> > I need to update all of records' synchronized attribute to 'True' in
> > page table where the space.id is 1.
> >
> > from sqlobject.sqlbuilder import Update
> > Update(Page.sqlmeta.table, True, ..., "Space.q.id=1")
>
> Update is a low-level object, you have to convert it to an SQL query
> and run the query yourself:
>
> Page._connection.query(Page._connection.sqlrepr(
> Update(Page.sqlmeta.table, {"synchronized": True}, where=Space.q.id==1)
> ))
>
Sorry, I am trying this code now, but it does not work.
The error is
OperationalError: (1054, "Unknown column 'space.id' in 'where clause'")
I think maybe I need use the column in Page class, so I change the code :
Page._connection.query(Page._connection.sqlrepr(Update(Page.sqlmeta.table,
{"synchronized": True},
where=Page.q.space_id==1)))
And the error change to:
AttributeError: Page instance has no attribute 'space_id'
If I write Page.q.space, the error is
AttributeError: Page instance has no attribute 'space'
But I am sure there is space in Page class
--
with kind regards
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss