Skip to content

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

@mohamed-ameer

Description

@mohamed-ameer

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions