Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Lab error with recent version of mariaDB (>=10.2.4) #4196

Closed
ocorbier opened this issue Jan 11, 2018 · 4 comments
Closed

SQL Lab error with recent version of mariaDB (>=10.2.4) #4196

ocorbier opened this issue Jan 11, 2018 · 4 comments

Comments

@ocorbier
Copy link

Superset version

0.22.1

Expected results

RUN QUERY in SQL Lab without error

Actual results

Error when superset try to save the query in the "query" table

Steps to reproduce

Use MariaDB in a version >=10.2.4 for the superset database

analyze

The "query" table has a fields named "rows", which is a reserved word in recents versions of mariadb
See https://mariadb.com/kb/en/library/reserved-words/

trace

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python3.5/dist-packages/flask_appbuilder/security/decorators.py", line 52, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/superset/models/core.py", line 870, in wrapper
value = f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/superset/views/core.py", line 2145, in sql_json
session.flush()
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/session.py", line 2192, in flush
self._flush(objects)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/session.py", line 2312, in _flush
transaction.rollback(_capture_exception=True)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/langhelpers.py", line 66, in exit
compat.reraise(exc_type, exc_value, exc_tb)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 187, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/session.py", line 2276, in _flush
flush_context.execute()
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
rec.execute(self)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
uow
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
mapper, table, insert)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
execute(statement, params)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 226, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorvalue
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 217, in execute
res = self._query(query)
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 378, in _query
rowcount = self._do_query(q)
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 341, in _do_query
db.query(q)
File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 280, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.ProgrammingError: (mysql_exceptions.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rows, error_message, results_key, start_time, start_running_time, end_time, end' at line 1") [SQL: 'INSERT INTO query (client_id, database_id, tmp_table_name, user_id, status, tab_name, sql_editor_id, schema, sql, select_sql, executed_sql, limit, limit_used, select_as_cta, select_as_cta_used, progress, rows, error_message, results_key, start_time, start_running_time, end_time, end_result_backend_time, tracking_url, changed_on) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'] [parameters: ('BkP_daVVz', 1, '', 1, 'running', 'Untitled Query', 'HJmbOu6NEM', 'mydatabase', 'select * from mytable', None, None, 1000000, 0, 0, 0, 0, None, None, None, 1515669615230.653, None, None, None, None, datetime.datetime(2018, 1, 11, 11, 20, 15, 233410))]

@xrmx
Copy link
Contributor

xrmx commented Jan 11, 2018

Hopefully will be fixed upstream:
zzzeek/sqlalchemy#414

@xrmx
Copy link
Contributor

xrmx commented Jan 11, 2018

And please don't close the issue until we have a sqlalchemy release we depend on that works. This was already reported in #4188

@ocorbier
Copy link
Author

Thank you for the fast response, and now it's work !
Sorry i don't found the other issue, perhaps because the status is closed.
Thank's again

@xrmx
Copy link
Contributor

xrmx commented Jan 23, 2018

This would be fixed in sqlalchemy 1.2.3

xrmx added a commit to xrmx/superset that referenced this issue Jan 26, 2018
michellethomas pushed a commit to michellethomas/panoramix that referenced this issue May 24, 2018
* Bump sqlalchemy to 1.2.2

Fix apache#4196

* Bump sqlalchemy-utils to 0.32.21
wenchma pushed a commit to wenchma/incubator-superset that referenced this issue Nov 16, 2018
* Bump sqlalchemy to 1.2.2

Fix apache#4196

* Bump sqlalchemy-utils to 0.32.21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants