apache/superset

BigQuery errors when filters on text columns have apostrophes in them

Open

#35,857 opened on 2025年10月27日

GitHub で見る
 (14 comments) (0 reactions) (1 assignee)TypeScript (72,837 stars) (17,291 forks)batch import
data:connect:googlebigquerygood first issue

説明

Bug description

The bug is that BigQuery throws an error 400 POST on filters (and charts) when filters on text columns have apostrophes in them.

Screenshots/recordings

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

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • 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.

コントリビューターガイド