[sqlalchemy] Re: query for many-to-many relation

2016-12-19 Thread Michal Nowikowski
Hello, I meant something else. I assume that some Keywords were not assigned to any BlogPost. And now, without any modification to model, I would like to get a list of Keywords that are assigned to some BlogPosts. If it was one to many relation then I would just do: list_of_used_keywords =

Re: [sqlalchemy] Bundles and selecting from polymorphic tables

2016-12-19 Thread mike bayer
thanks, this is https://bitbucket.org/zzzeek/sqlalchemy/issues/3874/bundle-does-not-provide-entities-fails-on and the gerrit should merge today. On 12/19/2016 11:58 AM, Michael Williamson wrote: Hello! When selecting from a polymorphic table using a bundle, the query seems to drop the

[sqlalchemy] Re: query for many-to-many relation

2016-12-19 Thread Jonathan Vanasco
On Monday, December 19, 2016 at 11:26:31 AM UTC-5, Michal Nowikowski wrote: > > Imagine that we have many Keywords but not all of them are used (not all > are associated to some BlogPosts). > Now, how to get list of Keywords that are used anywhere (i.e. these that > are associated to some

[sqlalchemy] Bundles and selecting from polymorphic tables

2016-12-19 Thread Michael Williamson
Hello! When selecting from a polymorphic table using a bundle, the query seems to drop the condition on the discriminator. For instance, suppose we have an Employee class that has a name column, with subclasses Manager and Engineer. When I query for Manager.name, I get back the names of just the

[sqlalchemy] query for many-to-many relation

2016-12-19 Thread Michal Nowikowski
Hello, I have a problem with building a query where I'm using many-to-many relation. Let's take the example from tutorial: http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#building-a-many-to-many-relationship Imagine that we have many Keywords but not all of them are used (not all are