Hi!
I'm using tutorial
http://www.sqlalchemy.org/docs/04/ormtutorial.html#datamapping_manytomany
When I create and save 1st object, all works fine.
But when I save 2nd post-object with the SAME KEYWORD:
<cut lang="python">
wendy = session.query(User).filter_by(name='wendy').one()
post = BlogPost("Wendy's Blog Post #2", "This is a test #2", wendy)
post.keywords.append(Keyword('wendy')) ************** wendy already
exists
post.keywords.append(Keyword('2ndpost'))
</cut>
I got Exception:
...
sqlalchemy.exceptions.IntegrityError: (IntegrityError) (1062,
"Duplicate entry 'wendy' for key 2") u'INSERT INTO keywords (keyword)
VALUES (%s)' ['wendy']
How can I avoid that?
How to use old keyword as object??
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---