-
Notifications
You must be signed in to change notification settings - Fork 16
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
Filter not working for uuid column #25
Comments
Hi,
There's probably a universal solution to be found somewhere in SQLAlchemy, but I haven't found it yet. I'll have to do some further digging! |
Since a generic UUID type is being introduced in SQLAlchemy 2.0, I'm gonna wait until after that release before putting too much effort into this. I believe this bug relates to SQLAlchemy's bind_processor logic, so it might simply be fixed in a new, generic UUID type. |
SQLAlchemy 2.0.0 and 2.0.1 have been released recently. |
psycopg (3) is also affected by this. psycopg2 was not as it didn't cast string params to VARCHAR. It would be great if we could find a solution for this. |
@OliverHofkens @schwingkopf I see two options here: Both are non-breaking. 1) would be consistent with ODATAv4 and should be easy to implement. 2) is a bit ugly as we mix syntax of multiple ODATA versions and most likely it's a bit more expensive to implement. WDYT? |
Thanks for staying on top of this! I haven't been keeping up with all the new releases like SQLAlchemy 2, Psycopg3 and Python 3.12... |
I've encountered a similar issue with UUID handling, particularly when filtering UUID columns in queries, which caused type mismatch errors. I've made some changes to properly handle UUIDs and created a pull request #60 that resolves this. I upgraded to SQLAlchemy ^2.0 and tested the solution with both PostgreSQL and SQLite databases, successfully filtering by UUID. |
Hello,
thank you for this phantastic library, it helps me a lot!
However, I experienced that filtering by
uuid
columns is not working. Here a minimal example:Output:
[]
The
UUIDType(binary=False)
generatesCHAR(32)
.I found out that the following change to
./odata-query/sqlalchemy/sqlalchemy_clause.py
makes it work (is the missing 'py_' a typo?):Output:
[<__main__.MyTable object at 0x000001F8295C3DC0>]
Also it seems like the tests in
./odata-query/tests/integration/sqlalchemy/test_querying.py
do imply filtering withuuid
s but only against non-matching:Would be nice if this could be fixed.
*Edit:
Just found out that my proposed change leads to exceptions when using the
in
clause, that are otherwise not present:Outputs:
The text was updated successfully, but these errors were encountered: