Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Filters for Mysql datasource #2615

Closed
3 tasks done
kkalyan opened this issue Apr 13, 2017 · 7 comments
Closed
3 tasks done

Dashboard Filters for Mysql datasource #2615

kkalyan opened this issue Apr 13, 2017 · 7 comments

Comments

@kkalyan
Copy link
Contributor

kkalyan commented Apr 13, 2017

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar

Dashboard filters work seamlessly for Druid, but not for databases.

Superset version

0.17.4

Expected results

Clicking on user_id or product_id would refresh orders table.

Actual results

tables does not get refreshed.
image

Steps to reproduce

create mysql database withe following tables.

create table products (product_id INT, name VARCHAR(255));
create table users (user_id INT, name VARCHAR(255));
create table orders (user_id INT, product_id INT);

INSERT INTO products values (1,'product-1'),(2,'product-2'),(3,'product-3');
INSERT INTO users values (1,'user-1'),(2,'user-2'),(3,'user-3');
INSERT INTO orders values (1,1),(1,2),(1,3),(2,2),(3,3);

create 3 slices with 'table filter' selected and add them to dashboard.
clicking on any of the cells, does not refresh rest of the tables.

@mistercrunch @ascott

@xrmx
Copy link
Contributor

xrmx commented Apr 15, 2017

Anything interesting in the logs?

@kkalyan
Copy link
Contributor Author

kkalyan commented Apr 15, 2017

nothing, logs show SQL queries without any where clauses.

@mistercrunch
Copy link
Member

Are the columns checked ad "filterable"?

@kkalyan
Copy link
Contributor Author

kkalyan commented Apr 20, 2017

No, I did not make the fields Filterable earlier.
When I made them filterable I got the following error on other slices on selection

'int' object has no attribute 'strip'

@xrmx
Copy link
Contributor

xrmx commented Apr 20, 2017

@kkalyan care to provide a full stacktrace please?

@kkalyan
Copy link
Contributor Author

kkalyan commented Apr 21, 2017

stack trace

INFO:root:SELECT product_id AS product_id, name AS name
FROM products
 LIMIT 50000
ERROR:root:'int' object has no attribute 'strip'
Traceback (most recent call last):
  File "/home/y/share/superset/env/lib/python2.7/site-packages/superset/viz.py", line 234, in get_payload
    df = self.get_df()
  File "/home/y/share/superset/env/lib/python2.7/site-packages/superset/viz.py", line 78, in get_df
    self.results = self.datasource.query(query_obj)
  File "/home/y/share/superset/env/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 538, in query
    qry = self.get_sqla_query(**query_obj)
  File "/home/y/share/superset/env/lib/python2.7/site-packages/superset/connectors/sqla/models.py", line 463, in get_sqla_query
    values = [types.strip("'").strip('"') for types in eq]
AttributeError: 'int' object has no attribute 'strip'
INFO:root:Caching for the next 86400 seconds
INFO:werkzeug:209.131.62.124 - - [21/Apr/2017 13:20:42] "GET /superset/explore_json/table/12/?form_data=%7B%22datasource%22%3A%2212__table%22%2C%22viz_type%22%3A%22table%22%2C%22slice_id%22%3A25%2C%22granularity_sqla%22%3Anull%2C%22time_grain_sqla%22%3Anull%2C%22since%22%3A%227+days+ago%22%2C%22until%22%3A%22now%22%2C%22groupby%22%3A%5B%5D%2C%22metrics%22%3Anull%2C%22include_time%22%3Afalse%2C%22all_columns%22%3A%5B%22product_id%22%2C%22user_id%22%5D%2C%22order_by_cols%22%3A%5B%5D%2C%22table_timestamp_format%22%3A%22smart_date%22%2C%22row_limit%22%3Anull%2C%22page_length%22%3A0%2C%22include_search%22%3Afalse%2C%22table_filter%22%3Atrue%2C%22where%22%3A%22%22%2C%22having%22%3A%22%22%2C%22filters%22%3A%5B%5D%2C%22extra_filters%22%3A%5B%7B%22col%22%3A%22user_id%22%2C%22op%22%3A%22in%22%2C%22val%22%3A%5B1%5D%7D%5D%7D HTTP/1.1" 400 -
INFO:root:Caching for the next 86400 seconds
INFO:werkzeug:209.131.62.124 - - [21/Apr/2017 13:20:42] "GET /superset/explore_json/table/11/?form_data=%7B%22datasource%22%3A%2211__table%22%2C%22viz_type%22%3A%22table%22%2C%22slice_id%22%3A24%2C%22granularity_sqla%22%3Anull%2C%22time_grain_sqla%22%3Anull%2C%22since%22%3A%227+days+ago%22%2C%22until%22%3A%22now%22%2C%22groupby%22%3A%5B%5D%2C%22metrics%22%3Anull%2C%22include_time%22%3Afalse%2C%22all_columns%22%3A%5B%22product_id%22%2C%22name%22%5D%2C%22order_by_cols%22%3A%5B%5D%2C%22table_timestamp_format%22%3A%22smart_date%22%2C%22row_limit%22%3Anull%2C%22page_length%22%3A0%2C%22include_search%22%3Afalse%2C%22table_filter%22%3Atrue%2C%22where%22%3A%22%22%2C%22having%22%3A%22%22%2C%22filters%22%3A%5B%5D%2C%22extra_filters%22%3A%5B%7B%22col%22%3A%22user_id%22%2C%22op%22%3A%22in%22%2C%22val%22%3A%5B1%5D%7D%5D%7D HTTP/1.1" 200 -

@kkalyan
Copy link
Contributor Author

kkalyan commented May 8, 2017

Fixed with #2671

@kkalyan kkalyan closed this as completed May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants