15 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Is there a way to re...| From | Sent On | Attachments |
|---|---|---|
| Denis S. Otkidach | 26 Dec 2007 09:12 | |
| Michael Bayer | 26 Dec 2007 11:38 | |
| Denis S. Otkidach | 27 Dec 2007 01:11 | |
| Michael Bayer | 27 Dec 2007 13:58 | |
| Rick Morrison | 27 Dec 2007 13:59 | |
| braydon fuller | 27 Dec 2007 15:01 | |
| Rick Morrison | 27 Dec 2007 15:06 | |
| Denis S. Otkidach | 28 Dec 2007 02:49 | |
| Michael Bayer | 28 Dec 2007 07:25 | |
| Denis S. Otkidach | 11 Jan 2008 09:30 | |
| Michael Bayer | 11 Jan 2008 09:41 | |
| Denis S. Otkidach | 15 Jan 2008 05:20 | |
| Michael Bayer | 15 Jan 2008 07:54 | |
| Denis S. Otkidach | 16 Jan 2008 01:43 | |
| Michael Bayer | 16 Jan 2008 08:41 |
| Subject: | [sqlalchemy] Re: Is there a way to replace object in DB?![]() |
|---|---|
| From: | Denis S. Otkidach (deni...@gmail.com) |
| Date: | 01/16/2008 01:43:09 AM |
| List: | com.googlegroups.sqlalchemy |
On Jan 15, 2008 6:54 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
The last commit fails with: sqlalchemy.exceptions.IntegrityError: (IntegrityError) Referers.objectId may not be NULL u'UPDATE "Referers" SET "objectId"=? WHERE "Referers".id = ?' [None, 1]
right thats because the instance doesnt exist yet. its better for you to just use the straight ahead query.get(), if None then save() approach.
Do you mean obj2 (id of which should go to objectId column in this UPDATE)? If so, why it doesn't exist? It's saved (updated in fact) just several lines above, so it must be both in DB and in session.
The last lines of the original test case for convenience: [...] obj2 = replace(session, ModelObject(1, u'title2')) session.commit()
ref2 = ModelReferer(1, obj2) replace(session, ref2) session.commit()
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---




