[sqlalchemy] Automatically create secondary tables for many to many relationship?

2013-09-22 Thread jpeck
Given the arbitrary example below, I can't ever recall actually using the FooKeyword association table other than to set up mappings. I came up with a brute force method to generate the secondary table for me automatically, and I'm hoping someone can show me a better way to do this. My goal

Re: [sqlalchemy] Automatically create secondary tables for many to many relationship?

2013-09-22 Thread Michael Bayer
On Sep 22, 2013, at 5:24 PM, jpeck peck.j...@gmail.com wrote: And replace it with something like this: class Keyword(Base): snip (same as before) class Foo(Base): snip keywords = generate_many_to_many_for_me('Foo', 'Keyword')

RE: [sqlalchemy] Automatically create secondary tables for many to many relationship?

2013-09-22 Thread Jeff Peck
And replace it with something like this: class Keyword(Base): snip (same as before) class Foo(Base): snip keywords = generate_many_to_many_for_me('Foo', 'Keyword') there's a recipe for this at this blog post, you might consider

Re: [sqlalchemy] Automatically create secondary tables for many to many relationship?

2013-09-22 Thread Michael Bayer
On Sep 22, 2013, at 10:11 PM, Jeff Peck peck.j...@gmail.com wrote: And replace it with something like this: class Keyword(Base): snip (same as before) class Foo(Base): snip keywords = generate_many_to_many_for_me('Foo', 'Keyword')