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
loader option error messages #4433
Labels
bug
Something isn't working
loader options
ORM options like joinedload(), load_only(), these are complicated and have a lot of issues
orm
Milestone
Comments
zzzeek
added
bug
Something isn't working
orm
loader options
ORM options like joinedload(), load_only(), these are complicated and have a lot of issues
labels
Jan 9, 2019
Mike Bayer has proposed a fix for this issue in the master branch: Improve error messages in the area of loader options https://gerrit.sqlalchemy.org/1082 |
here are some cases to add in
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
loader options
ORM options like joinedload(), load_only(), these are complicated and have a lot of issues
orm
see if we can get every mistake here to make a clear error:
case one:
they don't see the wildcard. Can we catch that and re-state, or can we detect this within load_only() and not defer() ?
doesn't raise. why not? it's wrong. only if we call .all():
there's the error. two levels of bad, first off, it should be, "undefer() only applies to column based attributes, does not apply to relationship attribute "bs"". Secondly, like before, it should be stated in terms of load_only().
I just stated "data" is from "B", that's where it's from! you need to say, "Attribute B.data is in terms of class "B", but this query has no entity "B"". Also, "note full path from root mapper() must be speciied", please state the class, not the mapper
same double issue again - the first level of error message should be, "can't use wildcard loader against multiple entities A, B; please use Load(A).undefer(), Load(B).undefer" - and then, wrong again, the error has to be in terms of load only (so thats two test cases)
this query "works" because the subqueryload wipes out the load_only(A.bs) - but this should raise immediately, like above
amazingly, it doesnt' even work from Load(), just ignores it:
(Pdb) !s.query(A).options(Load(A).load_only(A.bs), subqueryload(A.bs).load_only("data"))
all the mapper options need to be doing a check up front for the right kind of attribute, at least when they get sent to query.options().
problem exists in the other direction too:
The text was updated successfully, but these errors were encountered: