超集切片查询错误

时间:2017-09-25 10:52:13

标签: python pandas cx-oracle superset

按下超集的切片页面上的“查询”按钮时, 发生以下错误。

Traceback (most recent call last):
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/superset/viz.py", line 251, in get_payload
    data = self.get_data(df)
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/superset/viz.py", line 1106, in get_data
    row = df.groupby(self.groupby).sum()[self.metrics[0]].copy()
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/pandas/core/generic.py", line 4416, in groupby
    **kwargs)
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/pandas/core/groupby.py", line 1699, in groupby
    return klass(obj, by, **kwds)
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/pandas/core/groupby.py", line 392, in __init__
    mutated=self.mutated)
  File "/home/sf400002285/superset_env/venv/lib/python3.4/site-packages/pandas/core/groupby.py", line 2690, in _get_grouper
    raise KeyError(gpr)
KeyError: 'SCODE'

SQL查询如下。

SELECT "SCODE",
       "sum__COUNT"
FROM
  (SELECT "SCODE" AS "SCODE",
          sum(COUNT) AS "sum__COUNT"
   FROM
     (SELECT CASE 性別コード
                 WHEN 5 THEN 
                 WHEN 6 THEN '男性既婚'
                 WHEN 7 THEN '女性独身'
                 WHEN 8 THEN '女性既婚'
                 else 'その他'
             END as scode ,
             COUNT(*) count
      FROM 顧客特定
      GROUP BY 性別コード) expr_qry
   GROUP BY "SCODE"
   ORDER BY sum(COUNT) DESC)
WHERE ROWNUM <= 50000

版本 超集= 0.19.1 cx_Oracle = 5.3

请告诉我如何解决它

0 个答案:

没有答案