Redash: Table isn't displayed with Date filter

Created on 27 May 2019  路  6Comments  路  Source: getredash/redash

Issue Summary

The table breaks if there is a date filter

Steps to Reproduce

1) with Python executor:

add_result_column(result, 'name', 'name', TYPE_STRING)
add_result_column(result, 'month__filter', 'month__filter', TYPE_DATE)
add_result_column(result, 'section__filter', section__filter', TYPE_STRING)


add_result_row(result, {
    'section__filter': 'c', 
    'month__filter': '2019-01-01', 
    'name': 'a'
})

2) comment month__filter column both in add column and row sections and the table will be shown.

Technical details:

  • Redash Version: master
Bug Frontend

Most helpful comment

@gabrieldutra the keys idea is interesting.

I took at a stab at it while exploring what's the issue and came up with:

https://github.com/getredash/redash/compare/fix-3836?expand=1

But it has the following flaws:

  1. Formats both dates and datetimes as datetime (we can live with this for now).
  2. Converts to string for comparison -- this can be resolved with your suggestion.

You're welcome to take it from here :)

All 6 comments

Are you sure the issue here is the date filter?

Here's an example with a date filter and it seems to work: https://redash-preview.netlify.com/queries/146/source.

@arikfr The column type in your example is Datetime not Date.

I've changed to Date and now it doesn't displayed.

I came here to comment that all of a sudden this no longer works, but now I see your comment which explains why :)

Thank you for helping with reproducing this.

Update: it happens with date time as well. The difference above is in the case of a datetime, it wasn't detected as such (because the SQLite data source returns all columns as strings). If it's detected as a datetime, it will fail the same way.

I ran a few tests on it yesterday, this is caused by Antd Select not supporting data that is not String or Number, so Moment values get this error. I'll try to open a PR for this today. My idea is to use the keys in the Select Options and then translate them on the onChange method by using values[key].

@gabrieldutra the keys idea is interesting.

I took at a stab at it while exploring what's the issue and came up with:

https://github.com/getredash/redash/compare/fix-3836?expand=1

But it has the following flaws:

  1. Formats both dates and datetimes as datetime (we can live with this for now).
  2. Converts to string for comparison -- this can be resolved with your suggestion.

You're welcome to take it from here :)

Was this page helpful?
0 / 5 - 0 ratings