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

Azure SQL - SQL Lab Query Error #3075

Closed
jasonstrimpel opened this issue Jul 4, 2017 · 2 comments
Closed

Azure SQL - SQL Lab Query Error #3075

jasonstrimpel opened this issue Jul 4, 2017 · 2 comments
Labels
inactive Inactive for >= 30 days

Comments

@jasonstrimpel
Copy link

jasonstrimpel commented Jul 4, 2017

Make sure these boxes are checked before submitting your issue - thank you!

  • [x ] I have checked the superset logs for python stacktraces and included it here as text if any
  • [x ] I have reproduced the issue with at least the latest released version of superset
  • [x ] I have checked the issue tracker for the same issue and I haven't found one similar (see notes below)

Superset version

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Superset 0.18.5
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

mssql+pyodbc==4.0.17
Database is Azure hosted database

Expected results

When executing a query in the SQL Editor against a successfully added table, I expect to see the results of the query and no error.

Actual results

HTML formatted stacktrace appears in the results tab below the query editor when selecting from dbo.CashOperations.

capture

HTML formatted error appears in the results tab below the query editor when selecting from CashOperations.

capture2

Full stacktrace from server when executing the dbo.CashOperations query.

2017-07-04 06:05:52,677:INFO:root:[stats_logger] (incr) sql_json
2017-07-04 06:05:52,679:INFO:root:Parsing with sqlparse statement SELECT TOP 100 [Id],
           [Asset],
           [ClientId],
           [DateTime],
           [Volume]
FROM dbo.CashOperations
2017-07-04 06:05:52,750:INFO:root:Triggering query_id: 26
2017-07-04 06:05:52,755:INFO:root:Parsing with sqlparse statement SELECT TOP 100 [Id],
           [Asset],
           [ClientId],
           [DateTime],
           [Volume]
FROM dbo.CashOperations
2017-07-04 06:05:52,794:INFO:root:Set query to 'running'
2017-07-04 06:05:52,847:INFO:root:Running query:
SELECT TOP 100 [Id],
           [Asset],
           [ClientId],
           [DateTime],
           [Volume]
FROM dbo.CashOperations
2017-07-04 06:05:52,847:INFO:root:SELECT TOP 100 [Id],
           [Asset],
           [ClientId],
           [DateTime],
           [Volume]
FROM dbo.CashOperations
2017-07-04 06:05:52,850:INFO:root:Handling cursor
2017-07-04 06:05:52,854:INFO:root:Fetching data: {u'changedOn': datetime.datetime(2017, 7, 4, 6, 5, 52, 758616), u'tempTable': u'', u'userId': 1, u'executedSql': u'SELECT TOP 100 [Id],\n           [Asset],\n           [ClientId],\n           [DateTime],\n           [Volume]\nFROM dbo.CashOperations', u'ctas': False, u'tab': u'Untitled Query', u'sqlEditorId': u'BkYvKs_4-', u'id': u'Syjte3_4Z', u'changed_on': '2017-07-04T06:05:52.758616', u'rows': None, u'endDttm': None, u'limit_reached': False, u'state': u'running', u'progress': 0, u'schema': u'dbo', u'dbId': 2, u'errorMessage': None, u'db': u'jasonwallet', u'user': u'admin', u'sql': u'SELECT TOP 100 [Id],\r\n           [Asset],\r\n           [ClientId],\r\n           [DateTime],\r\n           [Volume]\r\nFROM dbo.CashOperations', u'startDttm': Decimal('1499148352702.784912'), u'limit': 1000000, u'serverId': 26, u'resultsKey': None}
2017-07-04 06:05:52,859:ERROR:root:Shape of passed values is (1, 100), indices imply (5, 100)
Traceback (most recent call last):
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/sql_lab.py", line 91, in get_sql_results
    ctask, query_id, return_results, store_results)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/sql_lab.py", line 210, in execute_sql
    list(data), columns=column_names))
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/pandas/core/frame.py", line 330, in __init__
    copy=copy)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/pandas/core/frame.py", line 483, in _init_ndarray
    return create_block_manager_from_blocks([values], [columns, index])
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/pandas/core/internals.py", line 4303, in create_block_manager_from_blocks
    construction_error(tot_items, blocks[0].shape[1:], axes, e)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/pandas/core/internals.py", line 4280, in construction_error
    passed, implied))
ValueError: Shape of passed values is (1, 100), indices imply (5, 100)
2017-07-04 06:05:52,860:INFO:root:[stats_logger] (incr) error_sqllab_unhandled
[2017-07-04 06:05:52,908] ERROR in app: Exception on /superset/sql_json/ [POST]
Traceback (most recent call last):
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 52, in wraps
    return f(self, *args, **kwargs)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/models/core.py", line 759, in wrapper
    value = f(*args, **kwargs)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/views/core.py", line 2055, in sql_json
    if data.get('status') == QueryStatus.FAILED:
AttributeError: 'NoneType' object has no attribute 'get'
Exception on /superset/sql_json/ [POST]
Traceback (most recent call last):
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 52, in wraps
    return f(self, *args, **kwargs)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/models/core.py", line 759, in wrapper
    value = f(*args, **kwargs)
  File "/home/jasonx/venv/local/lib/python2.7/site-packages/superset/views/core.py", line 2055, in sql_json
    if data.get('status') == QueryStatus.FAILED:
AttributeError: 'NoneType' object has no attribute 'get'

Steps to reproduce

  1. Add database to Superset successfully
  2. Add table to Superset successfully
  3. Select the database, schema and table from the query options on the left of the SQL Lab (columns of table load successfully)
  4. Run preview query

I found a thread referencing this issue on a Google group here however it seemed to reference an earlier version of Superset (0.17.5). The responder mentionss "for Azure we currently don't have an entry for it in the docs as and in the module db_engine_specs.py where we specify specific logic or configuration that Superset requires" however there is a MssqlEngineSpec(BaseEngineSpec) class.

Curious if this is indication there is no support of if this is an issue. It should be noted I can create visualization slices with no errors using the same datasource.

@jasonstrimpel jasonstrimpel changed the title Azure SQL SQL Lab Query Error Azure SQL - SQL Lab Query Error Jul 4, 2017
@xrmx
Copy link
Contributor

xrmx commented Jul 11, 2017

I think the issue here is that sql_lab.get_sql_results should raise again the exception after doing the cleanup so that the callers can handle the failure too. Then i have no clue for the pandas exception though.

xrmx added a commit to xrmx/superset that referenced this issue Jul 29, 2017
As caller expect it to raise an exception instead of returning
None.

Refs apache#3075
mistercrunch pushed a commit that referenced this issue Aug 2, 2017
As caller expect it to raise an exception instead of returning
None.

Refs #3075
@stale
Copy link

stale bot commented Apr 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

2 participants