Hi,
while upgrading one of my apps to SA 1.4, paying attention toward 2.0
compatibility, I found one single issue that I was not able to figure out
whether I'm doing something wrong or missed something in the excellent
migration guide.
All tests pass, but executing them with SQLALCHEMY_WARN_20 I noticed the
following message:
RemovedIn20Warning: Using strings to indicate column or relationship paths
in loader options is deprecated and will be removed in SQLAlchemy 2.0...
It was not so simple to isolate the culprit code, but I eventually found the
cause: here and there my app uses the load_only() option to load a subset of
the columns of related entities, and that's what upsets the compatibily check.
I'm attaching below a simple script that exhibits the problem (when executed
with SQLALCHEMY_WARN_20=1).
The documentation[1] shows a very similar usage, so I'm not sure where's the
problem. Maybe using joinedload(X.y).load_only(a, b), a and b cannot be column
names under 2.0, but should be Y.a and Y.b instead?
Thanks a lot for any hint,
ciao, lele.
[1]
https://docs.sqlalchemy.org/en/14/orm/query.html#sqlalchemy.orm.Load.load_only