-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Unwanted backslash is added before an underscore #982
Comments
BigQuery has a different escaping rule, compared to other SQL dialects:
https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#like_operator In other SQL dialects, one backslash is the default escape character. Function for escaping values for LIKE in SQL: But for now, you can use a workaround. One way is to override const config = merge(InitialConfig, {
widgets: {
text: {
sqlFormatValue: function (val, fieldDef, wgtDef, op, opDef) {
if (opDef.sqlOp == "LIKE" || opDef.sqlOp == "NOT LIKE") {
return this.utils.SqlString.escapeLike(
val,
op != "starts_with",
op != "ends_with"
).replace(/\\([%_]|\\)(?!'$)/g, "\\\\$1");
} else {
return this.utils.SqlString.escape(val);
}
},
}
}
}); (see original function: https://github.com/ukrbublik/react-awesome-query-builder/blob/master/packages/core/modules/config/index.js#L566) Another way is to use CONTAINS: const config = merge(InitialConfig, {
operators: {
like: {
sqlOp: "CONTAINS",
},
not_like: {
sqlOp: "NOT CONTAINS",
},
}
}); |
Please use |
Describe the bug

When using "Contains" with an input that includes an underscore, a backslash (for escaping) is added before the underscore:
The result would be:
The added backslash actually breaks the query in Google Big Query. Is it possible to not have this backslash added? I couldn't find anything in the docs
To Reproduce
Add text input to "Contains" which includes an underscore
Expected behavior
A backslash will not be added
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: