I am getting that same error (not the original one). For the moment i've
solved the problem in a different way, but it might pop up again. I'll keep
merge in mind (i've run into the is already attached to session before).
Thank you, Lars
On Monday, September 2, 2013 9:18:11 PM UTC+2, Simon
I realised after I sent that script that I wasn't reproducing quite
the same situation. I should have loaded the person from the database
in sess2 as well, before trying to add the instance from sess1. In
other words, change the end of the test script to say:
sess2 = Session()
dupe =
My version is 0.7.5 (thought i was on 8 already), i will look at updating!
The error sounds similar, I'll get back on this after i do (after some
research to find out if updating is a good idea right now)
Cheers, Lars
On Tue, Sep 3, 2013 at 11:38 AM, Simon King si...@simonking.org.uk wrote:
Hi all,
I have a one-to-one and many-to-one relationship (with an association table
in the middle; Report.author-assoctable-Person.reports; why the table in
the middle, you might ask, well it's a long story) and i am setting the
author on a specific Report twice to the same value. This gives
On Mon, Sep 2, 2013 at 4:01 PM, lars van gemerden l...@rational-it.com wrote:
Hi all,
I have a one-to-one and many-to-one relationship (with an association table
in the middle; Report.author-assoctable-Person.reports; why the table in the
middle, you might ask, well it's a long story) and i
Well, from the message yes, but i am not setting any primary keys manually, so
where could the second instance come from?
CL
Lars van Gemerden
l...@rational-it.com
+31 6 26 88 55 39
On 2 sep. 2013, at 17:39, Simon King
Without knowing your application it's very difficult to know...
Is there any chance that the second object is already associated with a
different session? Perhaps from a different thread, or retrieved from a cache
or something similar?
Producing a standalone test script would help in
Yes I know the question was a bit vague, but i couldn't think of a simple
way to show some code. A test case would probably require some major
surgery; I'll consider it though.
It is possible that the second instance is associated with a different
session, i'd have to check. What actually happens
Dunno, let's try it:
import sqlalchemy as sa
import sqlalchemy.orm as saorm
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Person(Base):
__tablename__ = 'people'
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
name =