question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Needs to support `FT.AGGREGATE` / RediSearch aggregations.

See original GitHub issue

This client needs to support RediSearch aggregations / FT.AGGREGATE.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
chayimcommented, Aug 11, 2022

Big fan of the second approach, and ensuring that we can do chained aggregations. This would both feel very much in spirit with this library, and align really well to other Python ORMs (I’m looking at Django!).

It feels “strange” that we’re not aggregating a query, if only because traditionally those things march in tandem.

One syntax I’m a fan of is:

model.agggregate(Avg=model.Fieldname, Sum=model.FieldName)

This makes chaining a little cleaner. Through approach this may eventually lead to class based aggregations. My biggest concern is that it feel “pythonic”. The downside from approaches like this are reserved names, leading to Capitalized variables.

@wiseaidev ?

0reactions
wiseaidevcommented, Aug 11, 2022

ensuring that we can do chained aggregations.

I recently started to realize that. That’s right!

The downside from approaches like this are reserved names, leading to Capitalized variables.

How about passing the aggregate functions as strings:

model.agggregate(model.Fieldname='sum', model.FieldName='min')

The user can enter whatever they like, however in the code, you can always do .lower thing.

Edit:

I think it requires a new proxy expression, something like:

@dataclasses.dataclass
class AggregationExpression:
    left: Optional[ExpressionOrModelField]
    right: RediSearchAggregationReducers
    parents: List[Tuple[str, "RedisModel"]]

Similar functionality to FindQuery, but here, we have = instead of ==.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FT.AGGREGATE - Redis
Attributes needed for aggregations should be stored as SORTABLE , where they are available to the aggregation pipeline with very low latency ...
Read more >
RediSearch Update: Aggregation & New Features | Redis
Synonym Support. In a situation where you have complete equivalents with different spellings, matching can be tricky. With FT.SYNADD and FT.
Read more >
redis - Having trouble getting aggregations working.
FT.AGGREGATE test "*" GROUPBY 1 @field REDUCE COUNT 0 AS agg ... I would have to LOAD "field" in order to perform an...
Read more >
RedisConf18 - Introducing RediSearch Aggregations
Introducing RediSearch Aggregations Super fast data processing ... FT.AGGREGATE idx “*” APPLY month(@time) AS month GROUPBY 1 @month REDUCE ...
Read more >
Getting Started with Redis and RediSearch
Aggregate the datasets using FT.AGGREGATE , and apply functions ... To start, you'll need to get a Redis database with RediSearch enabled.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found