]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Reverse Alias nesting concept
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 Jun 2019 16:45:05 +0000 (12:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 Jun 2019 17:49:33 +0000 (13:49 -0400)
commit3002c560ee0e23e045ff67617838220e736d31fc
treef77a91fbf536286171daea3d63ec40afe9078c30
parentb7dd98af83362475f6486d00689b20704f7c8001
Reverse Alias nesting concept

The Alias object no longer has "element" and "original", it now
has "wrapped" and "element" (the name .original is also left
as a descriptor for legacy access by third party dialects).
These two data members refer to the
dual roles Alias needs to play, where in the Python sense it needs
to refer to the thing it was applied against directly, whereas in the
SQL sense it needs to refer to the ultimate "non-alias" thing it
refers towards.   Both are necessary to maintain.  However, the change
here has each Alias object access the non-Alias object immediately
so that the "unwrapping" is simpler and does not need any special
logic.

In the SQL sense, Alias objects don't nest, the only potential
was that of the CTE, however there is no such thing as
a nested CTE, see link below.

This change is an interim change along the way to breaking Alias
into more classes and breaking away Select objects from being
FromClause objects.

Change-Id: Ie7a0d064226cb074ca745505129b5ec7d879e389
References: https://stackoverflow.com/questions/1413516/can-you-create-nested-with-clauses-for-common-table-expressions
lib/sqlalchemy/dialects/firebird/base.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/selectable.py
test/sql/test_selectable.py