engine: do not hardcode cube's json field name (#38067)

This commit is contained in:
Benjamin Dauvergne 2019-11-29 15:29:04 +01:00
parent a868f11d42
commit 3f7bedf0d3
1 changed files with 2 additions and 1 deletions

View File

@ -209,7 +209,8 @@ class JSONDimensions(object):
return []
if not self.__cache:
with self.engine.get_cursor() as cursor:
sql = 'select distinct jsonb_object_keys(json_data) as a from formdata order by a'
sql = ('select distinct jsonb_object_keys(%s) as a from formdata order by a'
% self.engine_cube.json_field)
cursor.execute(sql)
self.__cache = [row[0] for row in cursor.fetchall()]
return self.__cache