def Catalog(Base, Product):
class Catalog(Base):
__tablename__ = 'catalog'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.Unicode(255))
@aggregated('products', sa.Column(TSVectorType))
def product_search_vector(self):
return tsvector_reduce_concat(
sa.func.to_tsvector(Product.name)
)
products = sa.orm.relationship('Product', backref='catalog')
return Catalog
test_search_vectors.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录