[Sqlalchemy-tickets] Issue #3987: Select duplicates itself when using column() on its own column (z
Brought to you by:
zzzeek
From: dataradiant <iss...@bi...> - 2017-05-12 09:12:14
|
New issue 3987: Select duplicates itself when using column() on its own column https://bitbucket.org/zzzeek/sqlalchemy/issues/3987/select-duplicates-itself-when-using-column dataradiant: I suspect `Select.column()` is intended to be passed columns from a `table` rather than itself, but if that's the case a note in the documentation would helpful. My actual usage was a lot more complicated than the example and this took a while to figure out. ``` #!python from sqlalchemy import select, table, column, func t1 = table("t1", column("c1")) s1 = select([t1]) s2 = s1.column(func.min(s1.c.c1)) # >>> str(s2) # 'SELECT t1.c1, min(c1) AS min_1 \nFROM t1, (SELECT t1.c1 AS c1 \nFROM t1)' s3 = s1.column(func.min(t1.c.c1)) # Note that using the column from the table rather than the Select works fine # >>> str(s3) # 'SELECT t1.c1, min(t1.c1) AS min_1 \nFROM t1' ``` |