Commit 347cce51 by Clinton Blackburn

Merge pull request #55 from edx/concat-bug-fix

Fixing MySQL GROUP_CONCAT() Issues
parents 1de62169 3be0074a
......@@ -645,7 +645,14 @@ FROM answer_distribution
WHERE course_id = %s
GROUP BY module_id;
"""
with connections[settings.ANALYTICS_DATABASE].cursor() as cursor:
connection = connections[settings.ANALYTICS_DATABASE]
with connection.cursor() as cursor:
if connection.vendor == 'mysql':
# The default value of group_concat_max_len, 1024, is too low for some course data. Increase this value
# to its maximum possible value. For more information see
# http://code.openark.org/blog/mysql/those-oversized-undersized-variables-defaults.
cursor.execute("SET @@group_concat_max_len = @@max_allowed_packet;")
cursor.execute(sql, [self.course_id])
rows = dictfetchall(cursor)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment