-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
deprecate aliased=True, from_joinpoint=True, string join names / multijoin, joining to Core via ORM property #4705
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
Comments
one issue is that we can't get rid of mapper-level with_polymorphic as that's a very useful feature. Most of the complexity of aliased=True is also used for with_polymorphic. |
it's still worth getting rid of it just doesn't take that much code out of query.py. |
Update, it does, because aliased=True / from_joinpoint are the only reason we need to be applying adaptation per call to filter(), having(), order_by(), group_by(). Without them, all the adaption becomes at once when we create the SELECT, that is, we can move it all to one single adaption to ._whereclause , ._order_by etc. This means we can unify with base select() way more easily, we can use the same methods for base select() as we do for ORM select() and we greatly reduce call overhead. it's getting close to where we need to have 2.0 going at the same time. |
Here is another form_joinpoiint use case that would have to go away:
so in that case, the assertion needs to encourage them to do:
which means we start to have to deprecate the whole concept of join() accepting string relationship names and then the whole idea of join("a", "b", "c", ..) should go as well, certainly in 2.0 that should be gone. that's a big change. |
this use case has to be depreacted as well so that more implicit aliasing can be removed:
the correct pattern should be:
or join(Company.employees.of_type(pjoin)) |
I want to see if I can do these deprecations first, and get the tests set up, before I merge https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/1599 . this means I'll have to port to 1599 but I want this basic set of deps to be set up before we take a huge left turn with 1599. |
Mike Bayer referenced this issue: Unify Query and select() , move all processing to compile phase https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/1599 |
For a 1.4 / 1.3 merge, rewrite the documentation for Query.join() to indicate calling forms that are now considered legacy, including the use of strings in join(), sending a series of join paths in one call, and using the aliased=True flag. update the elementtree examples as well to use aliased() (they are much simpler to understand this way too) and update other links. Also improve docs for aliased() and some other ORM targets such as PropComparator. Change-Id: I636e3a9130dc5509e51c2cf60a52f38fcadffbc6 References: #4705 (cherry picked from commit 9f6b67a)
For a 1.4 / 1.3 merge, rewrite the documentation for Query.join() to indicate calling forms that are now considered legacy, including the use of strings in join(), sending a series of join paths in one call, and using the aliased=True flag. update the elementtree examples as well to use aliased() (they are much simpler to understand this way too) and update other links. Also improve docs for aliased() and some other ORM targets such as PropComparator. Change-Id: I636e3a9130dc5509e51c2cf60a52f38fcadffbc6 References: #4705
Convert Query to do virtually all compile state computation in the _compile_context() phase, and organize it all such that a plain select() construct may also be used as the source of information in order to generate ORM query state. This makes it such that Query is not needed except for its additional methods like from_self() which are all to be deprecated. The construction of ORM state will occur beyond the caching boundary when the new execution model is integrated. future select() gains a working join() and filter_by() method. as we continue to rebase and merge each commit in the steps, callcounts continue to bump around. will have to look at the final result when it's all in. References: #5159 References: #4705 References: #4639 References: #4871 References: #5010 Change-Id: I19e05b3424b07114cce6c439b05198ac47f7ac10
we don't need to deprecate multi-join as Query is legacy overall in any case. |
Mike Bayer has proposed a fix for this issue in the master branch: Deprecate strings indicating attribute names https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2303 |
ah we've already documented it https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#orm-query-chaining-using-lists-of-attributes-rather-than-individual-calls-removed |
in the interests of allowing select().join() to be a thing for Core and ORM at the same time, removing the major complexity of aliased=True should help. In #4704 we see that nobody has noticed aliased=True wasn't working that great, and a code search is turning up very few people actually using this API, although codesearch hits are vastly overwhelmed by projects that have bundled SQLAlchemy's source code and example suite. Within Openstack, there are three projects using it extremely minimally:
http://codesearch.openstack.org/?q=aliased%3DTrue&i=nope&files=&repos=
on github I can barely find one or two projects legitimately using it.
aliased=True was made back before
aliased()
existed, nor didof_type()
. Using explicit aliases now is pretty easy:or
q = q.join(ba, Foo.bar)
The text was updated successfully, but these errors were encountered: