Indeed, I do have TaskTags mapped to it's own class.  However, I never
explicitly delete any TaskTag object, only create them.

In any case, what would the preferred way to add a new tag to a task (a new
entry in the association table)?  I was using the ORM to just create a new
instance of TaskTag (the mapped class).  If having the association table
mapped to its own class becomes problematic, what's the convention for
accomplishing this?

Thanks for your feedback :-)

-Dave

On Wed, Dec 2, 2009 at 4:58 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

>
> On Dec 2, 2009, at 5:46 PM, Dave Paola wrote:
>
> I'm getting this: ConcurrentModificationError: updated rowcount 0 does not
> match number of objects updated 1 when I try to commit a simple deletion.
>  I'm using Sqlite locally but the error also occurs on a Postgres database
> in a live environment with only ONE user connected.
>
> I saw this post from Nov. 11th:
> http://groups.google.com/group/sqlalchemy/browse_thread/thread/e7175c7351963128but
>  because I'm not doing any copying (just deletion), it didn't seem to
> provide anything useful.  Both session.dirty and session.new are empty.
>
> I have a Task class mapped to an association table called TaskTag that has
> a task_id and tag_id.  I'm literally doing a session.delete(task) followed
> by a session.commit() and session.close().  Here's my mapper:
>
> mapper(Task, tasks_table, properties = {
>                 'tags' :  relation(Tag, secondary=tasktags_table, lazy =
> False)
> })
>
> I suspect this has something to do with the many-to-many relationship, but
> for the life of me I cannot figure out what's going on.  Thanks in advance.
>
>
> this can happen if you have tasktags_table explicitly mapped elsewhere.
>  the mapper for tasktags_table will issue a DELETE, and then if Task.tags is
> also modified in some way that affects the same row, the DELETE issued
> corresponding to the relation() will not find its row.    In that case the
> "Concurrent" name is referring to two different configurations within a
> single flush conflicting with each other.  If this is your issue, strategies
> to address include placing viewonly=True on the relation() or using the
> association proxy pattern (you can even use both if you want to pick and
> choose how the SQL to load records is emitted).
>
> P.S. I use SqlAlchemy so often, I love the framework.  Thanks to everyone
> for your hard work, it's greatly appreciated :-)
>
>
> The compliments are appreciated !
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com<sqlalchemy%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to