Can't connect to MySql db because of 'sql_mode=only_full_group_by' error

I created a free MySql db to connect to my python flask app. However I cannot run a query because ‘sql_mode=only_full_group_by’ is turned on. How do i turn this feature permanently?

I have checked the advanced settings option on my db and this option is not present. Please find below the actual error log generated by my app:

" pymysql.err.OperationalError: (1140, “In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column ‘defaultdb.case_header.caseid’; this is incompatible with sql_mode=only_full_group_by”) "

1 Like

Hi Lexanalytics_cloud,

Have you checked this: python - SQLAlchemy: How to use group_by() correctly (only_full_group_by)? - Stack Overflow

Assuming that your Flask uses sqlalchemy, it’s almost certain that this page will solve your issue.

Good luck!

Samuel

2 Likes