class Product(Model):
__tablename__ = 'product'
...
usecase = relationship("ProductUsecaseMapping", cascade="save-update", lazy="joined")
class ProductUsecaseMapping(Model):
__tablename__ = 'product_usecase_mapping'
product_id = Column(String(36), ForeignKey('product.id'))
usecase_id = Column(Integer, ForeignKey('usecase.id'))
....
filter_for_searching_specific_products = {
'filter': {
'country_code': kwargs.pop('country'),
'category': kwargs.get('search_type'),
'usecase.usecase_id': {
'in': [kwargs.pop('usecase')]
}
}
}
It works for one-to-one relationship but not with one-to-may. With above filter I get an error saying -
'has()' not implemented for collections. Use any().
It works for one-to-one relationship but not with one-to-may. With above filter I get an error saying -