Closed EldanGS closed 3 years ago
Thanks for reporting. There is a gap from http request/response to gino query. Could you help to see what's the values passing to gino engine?
Thanks for reporting. There is a gap from http request/response to gino query. Could you help to see what's the values passing to gino engine?
Thanks for the response @wwwjfy, I've updated the description and added the code snippet for a detailed explanation.
@EldanGS Right, it's expected behavior. For detailed explanation, refer to https://github.com/python-gino/gino/blob/master/HISTORY.rst#2-none_as_none
@wwwjfy, Is it possible to disable this ability? It could be in many use cases preferable to get an instance with None value rather than just None. Because if someone querying to DB with some attributes (like a name in my example) then expected an instance of DB with ANY value. It would mean that the element is empty (None), not that it does not exist in the DB.
@EldanGS it's not possible in the latest release.
This is to prevent the potential crash if we manipulate the None
object using loaders.
On your side, could you add a check of None
and create an empty object? Returning an object with no valid values doesn't make much difference IMHO. I'd rather put this in the app to keep the library simpler.
@wwwjfy We can get the right answer through several merger operations, etc. But this will not be an explicit work with the database and ORM.
@fantix Hi there, I would like to bring your attention to this issue, maybe you've another point of view. Could you give some suggestions for that?
@EldanGS sorry for the late reply.
I think it does make sense to return empty object in the case that the row exists but the queried columns are empty. Let me try to see if it's possible, without affecting model loader.
@wwwjfy No problem, thank you for your reply.
You'll also add TODO that: https://github.com/python-gino/gino/blob/master/HISTORY.rst#2-none_as_none should be changed too in the future or I'll make PR for that.
peace, Eldan
If possible, I don't want to expose the option again but react differently. can check my PR as an attempt to address this.
Description
What I Did
Examples of bd & query:
I guess it happens because of: