RediSearch / redisearch-py

RediSearch python client
https://redisearch.io
BSD 2-Clause "Simplified" License
221 stars 62 forks source link

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

Open DeepAndy opened 4 years ago

DeepAndy commented 4 years ago

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'
DeepAndy commented 4 years ago

Works ok if redisearch-py installed from sources

laneme commented 4 years ago

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?

cheeseandcereal commented 4 years ago

Fixes for aggregation were released in version 0.8.0

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

rahil-p commented 3 years ago

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()