jvines opened a new issue, #35857:
URL: https://github.com/apache/superset/issues/35857
### Bug description
The bug is that BigQuery throws an error 400 POST on filters (and charts)
when filters on text columns have apostrophe's in them.
The filters are being constructed with single quotes like this:
```
WHERE column IN ('value1', 'value2', ...., 'value with (')', 'value n')
```
thus breaking the query.
### Screenshots/recordings
<img width="275" height="529" alt="Image"
src="https://github.com/user-attachments/assets/e0aa779c-9432-4175-83a5-ddd495138d79"
/>
### Superset version
4.1.3
### Python version
3.10
### Node version
16
### Browser
Chrome
### Additional context
The traceback is as follows:
```
Traceback (most recent call last):
File
"/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/dbapi/cursor.py",
line 220, in _execute
rows = client.query_and_wait(
File
"/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line
3611, in query_and_wait
return _job_helpers.query_and_wait(
File
"/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/_job_helpers.py",
line 509, in query_and_wait
return job_retry(do_query)()
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 293, in retry_wrapped_func
return retry_target(
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 153, in retry_target
_retry_error_helper(
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_base.py",
line 212, in _retry_error_helper
raise final_exc from source_exc
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 144, in retry_target
result = target()
File
"/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/_job_helpers.py",
line 450, in do_query
response = retry(client._call_api)(
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 293, in retry_wrapped_func
return retry_target(
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 153, in retry_target
_retry_error_helper(
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_base.py",
line 212, in _retry_error_helper
raise final_exc from source_exc
File
"/usr/local/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py",
line 144, in retry_target
result = target()
File
"/usr/local/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line
843, in _call_api
return call()
File
"/usr/local/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line
494, in api_request
raise exceptions.from_http_response(response)
google.api_core.exceptions.BadRequest: 400 POST
https://bigquery.googleapis.com/bigquery/v2/projects/toteat-dte-run/queries?prettyPrint=false:
Syntax error: concatenated string literals must be separated by whitespace or
comments at [3:38]
```
And the logs spit out this query:
```
SELECT sum(`product_quantity`) AS `Cantidad_de_Productos_d078c`
FROM `dataset`.`table`
WHERE `restaurant_name` IN ('Armando''s') AND `status` != 'CANCELED' AND
`canceled_line` = false AND `is_extra` = false AND `order_date` >=
CAST('2025-03-27' AS DATE) AND `order_date` < CAST('2025-10-28' AS DATE)"
```
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
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]