dosubot[bot] commented on issue #35857: URL: https://github.com/apache/superset/issues/35857#issuecomment-3716030444
<!-- Answer --> The best workaround right now is to avoid using the `IN` filter operator for text columns in BigQuery dashboards—switch to the `=` operator for single-value filters whenever possible. This sidesteps the parameter binding issue in the pybigquery dialect that causes the "Unexpected param" error when using `IN` with string values containing special characters like apostrophes ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/connectors/sqla/models.py#L33-L1775), [source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/core.py#L408-L741)). If you need multi-select filtering, you can try creating a virtual dataset in SQL Lab and use Jinja templating to manually construct the filter clause, for example: ```sql {% set values = filter_values('restaurant_name') %} {% if values %} AND restaurant_name IN ({{ values | where_in }}) {% endif %} ``` This lets you control how values are inlined and escaped, but requires manual SQL editing and may not work for all dashboard use cases. There’s no config flag or recent code fix that fully resolves this in Superset 5.x+; the root cause is a mismatch between how Superset inlines filter values and how pybigquery expects to expand parameters for `IN` clauses. If you need a robust solution for multi-select filters, you may need to monitor or contribute to upstream fixes in pybigquery or Superset. Let me know if you want more details on how to set up Jinja templating or virtual datasets for this workaround. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4e4de51c-69eb-4019-865b-94ed5801aa27?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20best%20workaround%20right%20now%20is%20to%20avoid%20using%20the%20%60IN%60%20filter%20operator%20for%20text%20columns%20in%20BigQuery%20dashboards%E2%80%94switch%20to%20the%20%60%3D%60%20operator%20for%20single-value%20filters%20whenever%20possible.%20This%20sidesteps%20the%20parameter%20binding%20issue%20in%20the%20pybigquery%20dialect%20that%20causes%20the%20%22Unexpected%20param%22%20error%20when%20using%20%60IN%60%20with%20string%20values%20containing%20special%20characters%20like%20apostrophes%C2%A0%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/connectors/sqla/models.py%23L33-L1775%29%2C%20%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ff e45377799c/superset/models/core.py%23L408-L741%29%29.%0A%0AIf%20you%20need%20multi-select%20filtering%2C%20you%20can%20try%20creating%20a%20virtual%20dataset%20in%20SQL%20Lab%20and%20use%20Jinja%20templating%20to%20manually%20construct%20the%20filter%20clause%2C%20for%20example%3A%0A%0A%60%60%60sql%0A%7B%25%20set%20values%20%3D%20filter_values%28%27restaurant_name%27%29%20%25%7D%0A%7B%25%20if%20values%20%25%7D%0A%20%20AND%20restaurant_name%20IN%20%28%7B%7B%20values%20%7C%20where_in%20%7D%7D%29%0A%7B%25%20endif%20%25%7D%0A%60%60%60%0A%0AThis%20lets%20you%20control%20how%20values%20are%20inlined%20and%20escaped%2C%20but%20requires%20manual%20SQL%20editing%20and%20may%20not%20work%20for%20all%20dashboard%20use%20cases.%0A%0AThere%E2%80%99s%20no%20config%20flag%20or%20recent%20code%20fix%20that%20fully%20resolves%20this%20in%20Superset%205.x%2B%3B%20the%20root%20cause%20is%20a%20mismatch%20between%20how%20Superset%20inlines%20filter%20values%20and%20how%20pybigquery%20expects%20to%20exp and%20parameters%20for%20%60IN%60%20clauses.%20If%20you%20need%20a%20robust%20solution%20for%20multi-select%20filters%2C%20you%20may%20need%20to%20monitor%20or%20contribute%20to%20upstream%20fixes%20in%20pybigquery%20or%20Superset.%0A%0ALet%20me%20know%20if%20you%20want%20more%20details%20on%20how%20to%20set%20up%20Jinja%20templating%20or%20virtual%20datasets%20for%20this%20workaround.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/35857) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
