-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
fix: set allow filter_select
for Query objects in Explore
#20754
Conversation
52fe40d
to
24ffaba
Compare
Codecov Report
@@ Coverage Diff @@
## master #20754 +/- ##
==========================================
+ Coverage 66.20% 66.24% +0.03%
==========================================
Files 1754 1756 +2
Lines 66678 66758 +80
Branches 7049 7049
==========================================
+ Hits 44143 44221 +78
- Misses 20738 20740 +2
Partials 1797 1797
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -1189,6 +1189,38 @@ def _get_top_groups( | |||
|
|||
return or_(*groups) | |||
|
|||
def values_for_column(self, column_name: str, limit: int = 10000) -> List[Any]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that a better idea here is to use the Max display limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, otherwise good!
@@ -359,7 +359,7 @@ const AdhocFilterEditPopoverSimpleTabContent: React.FC<Props> = props => { | |||
const col = props.adhocFilter.subject; | |||
const having = props.adhocFilter.clause === CLAUSES.HAVING; | |||
|
|||
if (col && datasource && datasource.filter_select && !having) { | |||
if (col && datasource?.filter_select !== false && !having) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are adding the "filter_select": true in sql_lab.py we can remove this change. If we keep this change we don't need to make the change in sql_lab.py.
If we do keep this change, I realized we should actually do a check on datasource because datasource. operations are used within the if block. so recommend changing to this this:
if (col && datasource && datasource.filter_select !== false && !having) {
@@ -212,6 +212,7 @@ def columns(self) -> List[ResultSetColumnType]: | |||
@property | |||
def data(self) -> Dict[str, Any]: | |||
return { | |||
"filter_select": True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to my comment in the frontend change. If we add this here, the frontend change should not be needed.
SUMMARY
Allow filter select dropdown to execute
select distinct {col} from {table}
to make it easier for users to know what values are available to filter when in explore.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION