villebro commented on a change in pull request #9322: fix: handle list of lists
from fetch_data
URL:
https://github.com/apache/incubator-superset/pull/9322#discussion_r394535424
##########
File path: superset/result_set.py
##########
@@ -95,9 +96,10 @@ def __init__(
# generate numpy structured array dtype
numpy_dtype = [(column_name, "object") for column_name in
column_names]
- # put data in a structured array so we can efficiently access each
column.
- # cast `data` as list due to MySQL (others?) wrapping results with a
tuple.
- array = np.array(list(data), dtype=numpy_dtype)
+ # only do expensive recasting if datatype is not standard list of
tuples
+ if data and not isinstance(data, list) and not isinstance(data[0],
tuple):
+ data = [tuple(row) for row in data]
+ array = np.array(data, dtype=numpy_dtype)
Review comment:
@robdiciuccio I changed the logic so that this expensive operation only
takes place when needed.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]