frappe / frappe/eps

pymysql.err.OperationalError: (1055, "tabEnergy Point Log.creation' isn't in GROUP BY")

Open
#16 4 comments 0 reactions 1 assignee Claimed by @KerollesFathy View on GitHub
bug
Dominant language
Python
Stars
21
Forks
22
PR merge metrics
No merged PRs in 30d

Description

## Description of the issue

When opening the `/app/user-profile` page, Frappe throws the following SQL error: `pymysql.err.OperationalError: (1055, "tabEnergy Point Log.creation' isn't in GROUP BY")`.

This happens because my MariaDB/MySQL instance is running with the SQL mode `ONLY_FULL_GROUP_BY` enabled.
In this mode, MySQL requires that all selected fields be either aggregated or included in the `GROUP BY` clause.

The problematic query is generated inside: `/apps/frappe/frappe/desk/page/user_profile/user_profile.py` => `get_energy_points_heatmap_data` method.

This query selects:

- `UnixTimestamp(Date(eps_log.creation))` (not aggregated)
- `Sum(eps_log.points)` (aggregated)

…but only groups by `Date(eps_log.creation)`, which results in SQL error 1055 under strict mode.

### Possible solutions

1. Disable `ONLY_FULL_GROUP_BY` in the SQL server configuration (workaround).
2. Adjust the query so that the selected fields comply with strict SQL rules
(e.g., using `MAX()` around the timestamp expression or grouping by the exact expression used in the SELECT).
---

## Context information (for bug reports)

**Output of `bench version`**
```
"frappe": "15.99.0",
```

## Steps to reproduce the issue

1. Enable `ONLY_FULL_GROUP_BY` in MariaDB/MySQL SQL mode.
2. Log in to Frappe.
3. Open `/app/user-profile`.
4. The Energy Points heatmap fails to load and triggers SQL error 1055.

The page fails to render the Energy Points heatmap and raises an SQL OperationalError `(1055)` due to a GROUP BY mismatch.

### Expected result

The `/app/user-profile` page should load without SQL errors, and the Energy Points heatmap should compute correctly regardless of SQL mode.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.