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

feat(datasource): Checkbox for always filtering main dttm in datasource #25204

Merged

Conversation

Always-prog
Copy link
Contributor

SUMMARY

Fixes #22223.
There a feature in Superset that permanently adds a second time column to requests to Clickhouse, ElasticSearch, Kusto. But there is an problem with it, as many people think it's a bug :).

How about adding a checkbox for feature time secondary column to the dataset? i think it would be better than hardcoding it for all database connections (Clickhouse, elasticsearch, Kusto). It would also allow the ability to add a second time column to other databases. This PR doing it!

SCREENSHOTS

Here is how it looks for user

image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

@Always-prog Always-prog requested a review from a team as a code owner September 6, 2023 13:31
@Always-prog
Copy link
Contributor Author

@eschutho Hi! Should that checkbox be in the database connection? Or it need to be in the dataset settings.

@eschutho
Copy link
Member

eschutho commented Sep 6, 2023

@Always-prog this looks like good to me here in the dataset editor, but it wouldn't work for all databases, is that right?
cc @yousoph for another opinion.

Always-prog and others added 2 commits September 6, 2023 20:34
Co-authored-by: Elizabeth Thompson <[email protected]>
Co-authored-by: Elizabeth Thompson <[email protected]>
@Always-prog
Copy link
Contributor Author

@eschutho Currently this feature will works for all databases if checkbox is checked, and I think it's ok.

@Always-prog Always-prog requested a review from eschutho September 6, 2023 18:28
@yousoph
Copy link
Member

yousoph commented Sep 6, 2023

Suggestion on the text:

  • Use header text "Secondary Time Column"
  • Checkbox text: When secondary time columns are filtered, apply the same filter to the default datetime column

Should we call the field "Secondary Time Column" or "Secondary Datetime Column" to match "Default Datetime" in the datasets?

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, I think it's a better approach. I left a few comments, and also, can you add a unit test showing the query that is generated when the column is on vs. off?

superset/connectors/sqla/views.py Outdated Show resolved Hide resolved
superset/dashboards/schemas.py Outdated Show resolved Hide resolved
superset/db_engine_specs/base.py Show resolved Hide resolved
tests/integration_tests/fixtures/importexport.py Outdated Show resolved Hide resolved
@Always-prog
Copy link
Contributor Author

@betodealmeida Done, I added unit test and fixed name of the checkbox.

@justinpark
Copy link
Member

@Always-prog This commit looks more like a feature. Could you change the title from fix to feat?

@Always-prog Always-prog changed the title fix(datasource): Moved time secondary column to datasource settings feat(datasource): Moved time secondary column to datasource settings Sep 7, 2023
@Always-prog Always-prog changed the title feat(datasource): Moved time secondary column to datasource settings feat(datasource): Checkbox for always filtering main dttm in datasource Sep 7, 2023
@Always-prog
Copy link
Contributor Author

Always-prog commented Sep 7, 2023

@justinpark Done

@Always-prog
Copy link
Contributor Author

@eschutho @betodealmeida Hi!
Can I get merge?

@Always-prog
Copy link
Contributor Author

@eschutho Hi! If PR is ok, can I get merge :P?

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

@betodealmeida betodealmeida merged commit 14c3249 into apache:master Sep 14, 2023
eschutho added a commit to Superset-Community-Partners/superset that referenced this pull request Sep 21, 2023
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.1.0
Projects
None yet
6 participants