Skip to content

Commit

Permalink
Use list instead of numpy array (#2412)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkyryliuk authored Mar 15, 2017
1 parent 3107152 commit 0674ed8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from datetime import datetime
import json
import logging
import numpy as np
import pandas as pd
import sqlalchemy
import uuid
Expand Down Expand Up @@ -142,9 +141,8 @@ def handle_error(msg):
column_names = (
[col[0] for col in cursor.description] if cursor.description else [])
column_names = dedup(column_names)
df_data = np.array(data) if data else []
cdf = dataframe.SupersetDataFrame(pd.DataFrame(
df_data, columns=column_names))
list(data), columns=column_names))

query.rows = cdf.size
query.progress = 100
Expand Down

3 comments on commit 0674ed8

@openmax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi with this patch using pyodbc i got and error on sqllab :

2017-03-23 15:14:41,842:ERROR:root:Shape of passed values is (1, 5), indices imply (3, 5)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/superset/views/core.py", line 2043, in sql_json
data = sql_lab.get_sql_results(query_id, return_results=True)
File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 188, in call
return self._get_current_object()(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 420, in call
return self.run(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/superset/sql_lab.py", line 146, in get_sql_results
data, columns=column_names))
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 279, in init
copy=copy)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 432, in _init_ndarray
return create_block_manager_from_blocks([values], [columns, index])
File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3993, in create_block_manager_from_blocks
construction_error(tot_items, blocks[0].shape[1:], axes, e)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3970, in construction_error
passed, implied))
ValueError: Shape of passed values is (1, 5), indices imply (3, 5)

@xrmx
Copy link
Contributor

@xrmx xrmx commented on 0674ed8 Mar 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@openmax please report a new bug, let's not dig issues inside commit comments

@openmax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry , open issues #2461

Please sign in to comment.