Re: [Sqlalchemy-users] Question when follow the tutorial with many-to-many data mapping.

2006-08-30 Thread Michael Bayer
if you construct a new Keyword() instance like that, it will be inserted. youd have to do a session.query(Keyword).select_by (keyword_name='some_kw') or something similar if you want to get the existing one first. to make it more automatic you might want to try putting the check for exist

[Sqlalchemy-users] Question when follow the tutorial with many-to-many data mapping.

2006-08-30 Thread lazz
I follow the many-to-many data mapping. And find if I use: article.keywords.append(Keyword("some_kw")) SA will always add a new row to 'keywords' table whether the keyword existed or not. Is this normal? Or how can I specify an exist keyword to an article? -- I'm lazy, I'm coding. http://lazyco