shorten the "using aliases" tutorial section to just use alias() , then add a note "by the way you can also give them a name".

Issue #2145 resolved
Former user created an issue

http://www.sqlalchemy.org/docs/core/tutorial.html (version 0.6.7)

The second code example in the "Using Aliases" section is the same as the first example. The example is supposed to show "anonymous" aliases but it doesn't.

Comments (4)

  1. Mike Bayer repo owner

    the example is correct.

    First one is:

    >>> a1 = addresses.alias('a1')
    >>> a2 = addresses.alias('a2')
    

    second one is:

    >>> a1 = addresses.alias()
    >>> a2 = addresses.alias()
    

    SQL output is also different.

    however , that whole section is too verbose and using a name in the alias() is only worth a side mention, also the point that "anonymous aliases have the advantage of deterministic SQL" is not really accurate, as a named alias has the same behavior. just mention that anonymous aliases don't produce a "random" string.

  2. Log in to comment