Incubator-superset: Explore option in viz shows "Empty Query" error

Created on 1 Jul 2020  Â·  6Comments  Â·  Source: apache/incubator-superset

I built docker image from the code in master branch. I followed following steps to build and start docker container.

1) docker build -f superset:test -f Dockerfile .
2) docker run -d -p 10088:8080 -v /home/ubuntu/ssConfig:/app/pythonpath --health-cmd='curl -f localhost:8080' --name superset_test superset:test
3) docker exec -it superset_test superset fab create-admin --username admin --firstname Superset --lastname Admin --email [email protected] --password XXXXX
4) docker exec -it superset_test superset db upgrade
5) docker exec -it superset_test superset init

/home/ubuntu/ssConfig -> contains superset_config.py where I set DRUID_IS_ACTIVE to True and SQLALCHEMY_DATABASE_URI pointing to a postgres database.

After this I created a database that is setup to query druid broker. I input a group by query similar to the following -> SELECT eventId , eventType, COUNT(*) as counter FROM "druid_datasource_name" GROUP BY("eventId","eventType"); I can see the results in SQLTab. I clicked on "Explore" option to open visualization window.

Additional Tests =>

I tried the query SELECT country_code ,COUNT(*) as entries from wb_health_population GROUP BY("country_code"); -> included in examples. And then clicked on "Explore" in "Results" tab. I have attached a screenshot.

Expected results

I should see a table displayed in the visualization area.

Actual results

I see an error that says "Empty query?".

Stack Trace is shown below ---

Traceback (most recent call last):
File "/app/superset/viz.py", line 463, in get_df_payload
df = self.get_df(query_obj)
File "/app/superset/viz.py", line 240, in get_df
self.results = self.datasource.query(query_obj)
File "/app/superset/connectors/sqla/models.py", line 1128, in query
query_str_ext = self.get_query_str_extended(query_obj)
File "/app/superset/connectors/sqla/models.py", line 655, in get_query_str_extended
sqlaq = self.get_sqla_query(**query_obj)
File "/app/superset/connectors/sqla/models.py", line 798, in get_sqla_query
raise Exception(_("Empty query?"))
Exception: Empty query?

Environment

Environment
• superset version: 0.999.0dev
• python version: 3.6.10
• node.js version: 13.6.0
• npm version: 6.13.4

Checklist

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.

EmptyQuerySupersetExamples

#bug

All 6 comments

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.64. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Hi @shashanksingh,

Thank you for taking the time to report this issue. I'm able to reproduce.

Investigating

@dpgaspar thanks for that man, but I think the reporter, @shashisingh is a different human being :D

ups! sorry for that @shashanksingh

I think this was introduced here: #10113, still investigating

Seems like that when using explore from SQLLab we have this issue, but if we explore from the datasets list view using the created virtual dataset the charts render correctly

from SQLLab:
expore_json/ returns 400

form_data:

{"queryFields":{"groupby":"groupby","metrics":"metrics"},"datasource":"37__table","viz_type":"table","time_range_endpoints":["inclusive","exclusive"],"granularity_sqla":"last_login","time_grain_sqla":"P1D","time_range":"No filter","query_mode":"aggregate","groupby":[],"metrics":[],"all_columns":["id","first_name","last_name","username","password","active","email","last_login","login_count","fail_login_count","created_on","changed_on","created_by_fk","changed_by_fk"],"percent_metrics":[],"timeseries_limit_metric":null,"order_by_cols":[],"row_limit":1000,"include_time":false,"order_desc":true,"adhoc_filters":[],"table_timestamp_format":"smart_date","page_length":null,"include_search":false,"table_filter":false,"align_pn":false,"color_pn":true,"show_cell_bars":true}

from datasets list:

{"queryFields":{"groupby":"groupby","metrics":"metrics"},"datasource":"37__table","viz_type":"table","url_params":{},"time_range_endpoints":["inclusive","exclusive"],"granularity_sqla":"last_login","time_grain_sqla":"P1D","time_range":"Last week","query_mode":"aggregate","groupby":[],"metrics":["count"],"all_columns":[],"percent_metrics":[],"timeseries_limit_metric":null,"order_by_cols":[],"row_limit":10000,"include_time":false,"order_desc":true,"adhoc_filters":[],"table_timestamp_format":"smart_date","page_length":null,"include_search":false,"table_filter":false,"align_pn":false,"color_pn":true,"show_cell_bars":true}

missing the "metrics":["count"] on the first request

@ktmud can you take a look?

Fixed by apache-superset/superset-ui#659 and #10219. Sorry for the inconvenience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vylc picture vylc  Â·  3Comments

john-bodley picture john-bodley  Â·  3Comments

XiaodiKong picture XiaodiKong  Â·  3Comments

eliab picture eliab  Â·  3Comments

amien90 picture amien90  Â·  3Comments