blaze / blaze/blaze

SQL: how to generate "advanced" group by

Open
#1,594 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.2k
Forks
389
PR merge metrics
No merged PRs in 30d

Description

I have to generate a group by using a function (e.g. Date()) like this

``` sql
Select column1, avg(column2) from table group by date(column1)
```

But how can I generate such a query using blaze? I tried the following:

```
from blaze import by
by(data.column1, col2=data.column2.mean())
```

But how to add the date-function?

UPDATE: I found a solution for pandas, but I would prefer doing it with blaze (the database): http://stackoverflow.com/questions/11391969/how-to-group-pandas-dataframe-entries-by-date-in-a-non-unique-column

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Blaze's `by` operation and inspect how the database expression is translated for grouping. Reproduce the requested `date(column1)` grouping against a supported database, then determine how completion should be verified from the generated query and result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.