superset: Oracle backend: pandas Exception : KeyError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/caravel/views.py", line 827, in explore
    payload = obj.get_json()
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/caravel/viz.py", line 294, in get_json
    'data': self.get_data(),
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/caravel/viz.py", line 479, in get_data
    return self.get_df().to_html(
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/caravel/viz.py", line 474, in get_df
    margins=True,
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/tools/pivot.py", line 120, in pivot_table
    grouped = data.groupby(keys)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/generic.py", line 3778, in groupby
    **kwargs)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/groupby.py", line 1427, in groupby
    return klass(obj, by, **kwds)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/groupby.py", line 354, in __init__
    mutated=self.mutated)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/groupby.py", line 2383, in _get_grouper
    in_axis, name, gpr = True, gpr, obj[gpr]
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/frame.py", line 1997, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/frame.py", line 2004, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/generic.py", line 1350, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/core/internals.py", line 3290, in get
    loc = self.items.get_loc(item)
  File "/usr/local/Python-3.5.2/lib/python3.5/site-packages/pandas/indexes/base.py", line 1947, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:4154)
  File "pandas/index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas/index.c:4018)
  File "pandas/hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368)
  File "pandas/hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322)
KeyError: 'agent_name'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 30 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I just met exactly the same bug. My case is I’m connectting caravel AKA superset to Apache Kylin and use pykylin as sqlachemy dialect. Dimensions generated by Kylin are all uppercase and columns generated by caravel are lowercase. Thus when I use pivot table or any other charts the bug appears. Screenshot

And it’s weird when I uppercase all columns and save, the lowercase columns appear again. It seems pykylin sync from kylin

On the front-end, notice how the capitalization is different depending on if a PostGres or an Oracle DB is queried.

Oracle DB

columns come back in all caps

screen shot 2017-11-06 at 4 08 40 pm

PostGres DB

columns come back in all lower case

screen shot 2017-11-06 at 4 08 31 pm

This seems very relevant: https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/dialects/oracle/base.py#L56

Damn Oracle! and don’t get me started on the the 30 character limit on object names. Fully committed to bad decisions made in the 80s.