-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Nov 7, 2012, at 6:18 PM, Manlio Perillo wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi. > > When selecting against joined tables, SQLAlchemy always use the > "ON join_condition" form. > > The problem with this is that when the joined columns have the same > name, they are included 2 times in the result set. Only if you select all of those columns. There's no need to resort to side effects of unusual SQL syntaxes here, if you're already using the expression language to generate joins, then you should be specifying those columns you care about selecting when you call select(). Instead of passing "*" to select(), pass the Table object you care about. The names of the columns should be the least important thing here - the expression language deals in Table and Column objects first and foremost. > In alternative, this can be requested explicitly, as example: > > class Join(FromClause): > __visit_name__ = 'join' > > def __init__(self, left, right, onclause=None, using=None, > isouter=False): > ... > > When specified ``using`' take precedence over `onclause`. you can always build a subclass of Join and use @compiles to get at whatever you want, but I think the approach is a hacky way at getting at some other behavior through loose associations. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQmu+PAAoJEDMCOcHE2v7hkRMH/3bl3ML9azuF2dh7bN15YAFa 03yRaIRrNehDXlSOv/IFFAHhdkoS6CBMNO0c3ovpv+L3G8WoplN+6vfgzKAaZUo3 zIcpPYOOMYlDEp1A60E5HGx8n1W3NUq5X5ku7/nFMPqVJe8p+wgnimJE2A5WLjPy MQq46Wf39SrFO8aivso7jZk4GjPLneFiM0CgFsobvIgB6NxYPshB9WH8qkPEY6DX 5soMqTKTYcFSLIsv4flnu2hTbOvjI39hDE42i/DrBuue2vt7w5TbUds2o4YCjhDG TevUaGOtWWsQhsAVAr131UxbiHXChAIEYK5SomsLei+1GN5YMCP6pd0Sc7tqTBg= =VHJY -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.