-
Notifications
You must be signed in to change notification settings - Fork 81
[IMP] util.explode_query_range: replace problematic parallel_filter…
#142
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
Closed
Pirols
wants to merge
1
commit into
odoo:master
from
odoo-dev:master-remove_explode_query_range_format-pied
Closed
[IMP] util.explode_query_range: replace problematic parallel_filter…
#142
Pirols
wants to merge
1
commit into
odoo:master
from
odoo-dev:master-remove_explode_query_range_format-pied
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
bf79fa6 to
96a474e
Compare
210ef0a to
e800de2
Compare
aj-fuentes
reviewed
Sep 26, 2024
2b341f2 to
fd3ad98
Compare
aj-fuentes
reviewed
Sep 26, 2024
8bbcc71 to
6299ef9
Compare
aj-fuentes
reviewed
Sep 27, 2024
Contributor
aj-fuentes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
6299ef9 to
faf43c0
Compare
faf43c0 to
4b77c65
Compare
aj-fuentes
reviewed
Aug 28, 2025
4b77c65 to
29cef01
Compare
Contributor
Author
|
upgradeci retry with always only base |
29cef01 to
0d22545
Compare
… formatting The usage of `str.format` to inject the parallel filter used to explode queries is not robust to the presence of other curly braces. Examples: 1. `JSON` strings (typically to leverage their mapping capabilities): see 79f3d71, where a query had to be modified to accomodate that. 2. Hardcoded sets of curly braces: ```python >>> "UPDATE t SET c = '{usage as literal characters}' WHERE {parallel_filter}".format(parallel_filter="…") Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 'usage as literal characters' ``` Which can be (unelegantly) solved adding even more braces, leveraging one side-effect of `.format`: ```python >>> "UPDATE t SET c = '{{usage as literal characters}}' WHERE {parallel_filter}".format(parallel_filter="…") "UPDATE t SET c = '{usage as literal characters}' WHERE …" ``` 3. Hardcoded curly braces (AFAICT no way to solve this): ```python >>> "UPDATE t SET c = 'this is an open curly brace = {' WHERE {parallel_filter}".format(parallel_filter="…") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: unexpected '{' in field name ``` ```python >>> "UPDATE t SET c = 'this is a close brace = }' WHERE {parallel_filter}".format(parallel_filter="…") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Single '}' encountered in format string ```
0d22545 to
ddb84b2
Compare
Contributor
Author
|
In favor of #339 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

… formatting
The usage of
str.formatto inject the parallel filter used to explode queries is not robust to the presence of other curly braces. Examples:JSONstrings (typically to leverage their mapping capabilities):see 79f3d71, where a query had to be modified to accomodate that.
Which can be (unelegantly) solved adding even more braces, leveraging one side-effect of
.format: