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
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
2 matches
Mail list logo