-
Notifications
You must be signed in to change notification settings - Fork 192
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
👌 IMPROVE: Use sqlalchemy.func
for JSONB QB filters
#5393
Conversation
The QueryBuilder declared a custom `jsonb_typeof` FunctionElement, for which sqlalchemy disables query caching by default.
Removes the warning locally for me |
Cheers, can you try something of the lines of: QueryBuilder().append(Node, filters={"attributes.x": {'of_type': 'bool'}}).as_sql()
QueryBuilder().append(Node, filters={"attributes.x": {'of_length': 3}}).as_sql() just to check that this still compiles correctly. |
You mean this? (note: replaced 'bool' => 'boolean')
The one failing test is about a change in the SQL representation
but I think it's just about naming - the placeholder that used to be |
@chrisjsewell Does this look good to you? Do I need to update some test data to make this pass?
Is this due to some change I made or is mypy changing?~~ Ok, my bad, I removed a mypy ignore (because my local mypy complained about it not doing anything). |
Although locally mypy 0.930 complains: aiida/storage/psql_dos/orm/querybuilder/main.py:336: error: Unused "type: ignore" comment Found 1 error in 1 file (checked 1 source file)
Yeh the one you mentioned already: The change looks fine, it's a pytest-regressions test, so you can even run |
Great, thanks for the hints! |
Maybe just change the PR/commit name to something like |
Done! I'll still need your approving review for this to auto-merge |
change the PR name ☝️ |
sqlalchemy.func
for JSONB QB filters
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.
cheers!
related to #5282
The QueryBuilder declared a custom
jsonb_typeof
FunctionElement,for which sqlalchemy disables query caching by default.