-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Escaping UUID field in .fetch_related #151
Comments
Thank you for your bug report. Yes, as per your guess, this is definitely related to #81 Actually a bit surprised that UUID behaves so badly 🤔 It could be related to PostgreSQL natively supporting UUID as 128-bit binaries, and the other DB's using text. |
Fixes #151 * Fixes FK use cases of UUIDField as it works differently than int-autonumbers: * Is pre-generated, not post-generated. * Requires escaping/encoding differently for different DB backends. * Fixed M2M cases with UUIDFields. * Fixed select_related with UUIDFields.
Thanks. Your fix worked! |
A pleasure! Got there in the end! |
Describe the bug
The primary key UUID (maybe not only UUID) is not escaped when fetching external entities for the model using
.fetch_related
.To Reproduce
Expected behavior
Escaping the UUID value in a query as in the asyncpg example.
Additional context
Possibly related to the #81 issue and #122 PR.
Traceback 1 - PostgreSQL Syntax Error
Traceback 2 - Column Does Not Exist Error
Python version: CPython 3.7.3
Installed packages:
aenum==2.1.2
aiosqlite==0.10.0
asyncpg==0.18.3
ciso8601==2.1.1
PyPika==0.28.0
tortoise-orm==0.12.2
The text was updated successfully, but these errors were encountered: