RediSearch / redisearch-py

RediSearch python client

Home Page:https://redisearch.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aggregation doesn't work if installed by 'pip install redisearch'

DeepAndy opened this issue · comments

Aggregation doesn't work if installed by 'pip install redisearch'

pip install redisearch
import redisearch
aggregate_request = redisearch.aggregation.AggregateRequest()
AttributeError: 'module' object has no attribute 'aggregation'

Works ok if redisearch-py installed from sources

commented

I encountered a similar problem where it would work fine but vscode would show aggregation as undefined. So I downloaded the aggregation module from src and imported from there, rather than from installed redisearch by pip3. And it would show no problem.

This thing definitely has some problems deep inside. Did you figure it out what happened in your case?

commented

Fixes for aggregation were released in version 0.8.0

check again with this new version in pypi, it's probably resolved now

Given the current version (2.0.0), the example code above should still produce an AttributeError.

The redisearch module doesn't expose the aggregation submodule in its __init__.py file, so it's not available as an attribute of the module. Explicitly importing the submodule should fix it.

import redisearch.aggregation
# or `from redisearch import aggregation`

aggregate_request = redisearch.aggregation.AggregateRequest()