You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/01/31 16:01:03 UTC

[GitHub] yuyuhan0306 opened a new issue #6791: cannot use the "filter_values" variable in LIKE/ILIKE statements

yuyuhan0306 opened a new issue #6791: cannot use the "filter_values" variable in LIKE/ILIKE statements
URL: https://github.com/apache/incubator-superset/issues/6791
 
 
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
     http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [ v] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [ v] I have reproduced the issue with at least the latest released version of superset.
   - [ v] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Superset version
   0.28.0
   
   ### Expected results
   I created a filter box and would like to pass user inputs into SQL queries. I looked up the documentation about "filter_values". https://superset.incubator.apache.org/sqllab.html However, it seems that I can only use filter_values for "IN" statements instead of LIKE or ILIKE statements.
   
   The query I want to format is like the following: ("backpack" is user input)
   SELECT parsed_search AS parsed_search,
          COUNT(*) AS count
   FROM public.js_meta
   WHERE (((parsed_search ilike '%+backpack+%'
            or parsed_search ilike 'backpack+%'
            or parsed_search ilike '%+backpack')
           and parsed_search <>''))
   GROUP BY parsed_search
   ORDER BY count DESC
   LIMIT 50;
   
   I use the UI interface to write my query.
   Group by parsed_search
   Metrics COUNT(*)
   Filters
   (parsed_search ilike {{"'%+" + "".join(filter_values(parsed_search)) + "+%'" }} or
    parsed_search ilike {{"'" + "".join(filter_values(parsed_search)) + "+%'" }} or
    parsed_search ilike {{"'%+" + "".join(filter_values(parsed_search)) + "'" }}) and parsed_search <>''
   
   ### Actual results
   SELECT parsed_search AS parsed_search,
          COUNT(*) AS count
   FROM public.js_meta
   WHERE parsed_search IN ('backpack')
     AND (((parsed_search ilike '%++%'
            or parsed_search ilike '+%'
            or parsed_search ilike '%+')
           and parsed_search <>''))
   GROUP BY parsed_search
   ORDER BY count DESC
   LIMIT 50;
   
   ### Steps to reproduce
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org