Details
-
Type:
Improvement
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 3.9.0
-
Fix Version/s: 3.10.0
-
Component/s: app.editor
-
Labels:
-
Target Version:
-
Easy:Easy
Description
For MySQL DB-query, the app cannot function properly when the name of the database is a reserved keyword, for example 'order'. This is the traceback encountered:
Traceback (most recent call last):
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/apps/rdbms/src/rdbms/api.py", line 55, in decorator
return view_fn(*args, **kwargs)
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/apps/rdbms/src/rdbms/api.py", line 104, in tables
db.use(database)
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/desktop/libs/librdbms/src/librdbms/server/dbms.py", line 127, in use
self.client.use(database)
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/desktop/libs/librdbms/src/librdbms/server/mysql_lib.py", line 83, in use
cursor.execute("USE %s" % database)
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order' at line 1")
Adding backticks in file /opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.8/lib/hue/desktop/libs/librdbms/src/librdbms/server/mysql_lib.py line 83 seems to solve this issue.
cursor.execute("USE %s" % database) => cursor.execute("USE `%s`" % database)