mmuru commented on issue #9620:
URL: https://github.com/apache/superset/issues/9620#issuecomment-770493198
@villebro: I tested it with latest version 1.0 and sort_by issue is still
exist. Although it is still forced to select aggregate function for sort_by
column but it did not get included in the result.
`SELECT name AS name,
count(color) AS "COUNT(color)",
count(name) AS "COUNT(name)"
FROM public.bart_lines
GROUP BY name
ORDER BY "COUNT(name)" ASC
LIMIT 10000;`
Noticed the following issue: In the custom SQL, changing column name as
name2 the following query generated and throws exception.
`SELECT name AS name,
count(color) AS "COUNT(color)",
name as name2 AS "name as name2"
FROM public.bart_lines
GROUP BY name
ORDER BY "name as name2" DESC
LIMIT 10000;`
`Traceback (most recent call last):
File
"/Users/muru/venv367/lib/python3.6/site-packages/superset/connectors/sqla/models.py",
line 1274, in query
df = self.database.get_df(sql, self.schema, mutator)
File
"/Users/muru/venv367/lib/python3.6/site-packages/superset/models/core.py", line
390, in get_df
self.db_engine_spec.execute(cursor, sqls[-1])
File
"/Users/muru/venv367/lib/python3.6/site-packages/superset/db_engine_specs/base.py",
line 877, in execute
cursor.execute(query)
psycopg2.errors.SyntaxError: syntax error at or near "AS"
LINE 3: name as name2 AS "name as name2"`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]