I don't understand that error - you're asking it to join along predefined
relationships, so it shouldn't need to search for foreign keys at query
time. "Category.products" is a relationship set up as the backref of
Product.categories.
Here's a working example. I had to add the definition of the
With that query I get:
InvalidRequestError: Could not find a FROM clause to join from. Tried
joining to , but got: Can't find any
foreign key relationships between 'category' and 'product'.
Product and category model has many to many relationship
--
You received this message because you are
http://docs.sqlalchemy.org/en/rel_1_0/orm/tutorial.html#querying-with-joins
You want something like:
DBSession.query(Category).join(‘products’,
‘brand’).filter(Brand.slug==brand_slug)
Hope that helps,
Simon
> On 1 Mar 2016, at 20:11, sector119 wrote:
>
> It works, but