superset icon indicating copy to clipboard operation
superset copied to clipboard

JSON generation crash in Sankey Diagram

Open ruber0id opened this issue 7 years ago • 4 comments

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 there are 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.

Superset version

0.29rc7 (the last one published via Pypi)

Expected results

Actual results

The chart block raise TypeError with the following stacktrace not only for example data but also for other tables:

  File "/root/superset/lib/python3.7/site-packages/superset/views/base.py", line 96, in wraps
    return f(self, *args, **kwargs)
  File "/root/superset/lib/python3.7/site-packages/superset/views/core.py", line 1211, in explore_json
    samples=samples,
  File "/root/superset/lib/python3.7/site-packages/superset/views/core.py", line 1142, in generate_json
    payload = viz_obj.get_payload()
  File "/root/superset/lib/python3.7/site-packages/superset/viz.py", line 374, in get_payload
    payload['data'] = self.get_data(df)
  File "/root/superset/lib/python3.7/site-packages/superset/viz.py", line 1606, in get_data
    df['source'] = df['source'].astype(basestring)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/generic.py", line 5691, in astype
    **kwargs)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 531, in astype
    return self.apply('astype', dtype=dtype, **kwargs)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 395, in apply
    applied = getattr(b, f)(**kwargs)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 534, in astype
    **kwargs)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 595, in _astype
    dtype = pandas_dtype(dtype)
  File "/root/superset/lib/python3.7/site-packages/pandas/core/dtypes/common.py", line 2029, in pandas_dtype
    raise TypeError("dtype '{}' not understood".format(dtype))
TypeError: dtype '<class 'past.types.basestring.basestring'>' not understood

Sankey Diagram

Steps to reproduce

Environment

Ubuntu 18.04
python==3.7.1
pandas==0.24.1

ruber0id avatar Mar 13 '19 17:03 ruber0id

pandas==0.20.3,can be solved

AShyPig avatar Apr 29 '19 10:04 AShyPig

If this is still an issue in master, I think it could be addressed by adding a condition for basestring in superset.utils.core.base_json_conv

mistercrunch avatar Apr 30 '19 00:04 mistercrunch

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[bot] avatar Jun 29 '19 01:06 stale[bot]

Sorry to disturb an closed issue, I have the exact same problem with sanskey chart and downgrading pandas to pandas==0.20.3 doesn't solve it...

2019-08-20 09:35:34,392:ERROR:root:dtype '<class 'past.types.basestring.basestring'>' not understood
Traceback (most recent call last):
  File "/root/venv/lib/python3.6/site-packages/superset/views/core.py", line 1149, in generate_json
    payload = viz_obj.get_payload()
  File "/root/venv/lib/python3.6/site-packages/superset/viz.py", line 371, in get_payload
    payload['data'] = self.get_data(df)
  File "/root/venv/lib/python3.6/site-packages/superset/viz.py", line 1597, in get_data
    df['source'] = df['source'].astype(basestring)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/generic.py", line 5691, in astype
    **kwargs)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 531, in astype
    return self.apply('astype', dtype=dtype, **kwargs)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 395, in apply
    applied = getattr(b, f)(**kwargs)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/internals/blocks.py", line 534, in astype
    **kwargs)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/internals/blocks.py", line 595, in _astype
    dtype = pandas_dtype(dtype)
  File "/root/venv/lib/python3.6/site-packages/pandas/core/dtypes/common.py", line 2029, in pandas_dtype
    raise TypeError("dtype '{}' not understood".format(dtype))
TypeError: dtype '<class 'past.types.basestring.basestring'>' not understood

Does anyone has the solution..? Help is very much appreciated.

syafiqdante avatar Aug 20 '19 01:08 syafiqdante