Working from the many-many example in the tutorial [1], it has an association
table like this:
post_keywords = Table('post_keywords', Base.metadata,
Column('post_id', Integer, ForeignKey('posts.id')),
Column('keyword_id', Integer, ForeignKey('keywords.id'))
)
Normally to just empty everything from a table I'd do this:
session.query(BlogPost).delete()
But that doesn't work when there's an association table pointing to it. What's
the correct way to delete everything from an association table. Tried these:
session.query(post_keywords).delete()
session.query('post_keywords').delete()
Thanks,
Michael
[1]
http://www.sqlalchemy.org/docs/orm/tutorial.html#building-a-many-to-many-relationship
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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.