Re: [Sqlalchemy-users] Resolving Ambiguous Column Names

2006-04-21 Thread Michael Bayer
you should use the _label attribute on the column itself for the name, or just use the column: v = row[column._label] v = row[column] youre not going to want to turn off the max-length logic since your database is giong to start throwing errors (esp. if youre on oracle - 30 chars max! , b

Re: [Sqlalchemy-users] Resolving Ambiguous Column Names

2006-04-21 Thread Peter L. Buschman
Is there any way to turn off the max-length logic? I ran into it where one particular table and column both had particularly long names. I worked around it by using table aliases but the readability of the code suffered a bit. At 18:49 21.4.06, Michael Bayer wrote: yeah use_labels probably

Re: [Sqlalchemy-users] intro to the 0.2 series

2006-04-21 Thread Michael Bayer
actually, the semantics of import_() are much more equivalent to hibernate's merge(), not update(). now update() makes more sense to me. since I desperately want this to just be done, i am considering just throwing on very similar versions of load(), merge(), save(), update (), saveOrUpdate

Re: [Sqlalchemy-users] intro to the 0.2 series

2006-04-21 Thread Michael Bayer
On Apr 21, 2006, at 12:32 AM, Robert Leftwich wrote: Michael Bayer wrote: to me, the method means, "this is an object I loaded from some other Session and now I want it to be in this Session", thats why I like "import"...it implies youre "taking it from somewhere else and putting it he

Re: [Sqlalchemy-users] Resolving Ambiguous Column Names

2006-04-21 Thread Michael Bayer
yeah use_labels probably needed. or, you can also say: select([table1.c.mycol.label('somelabel') , table1.c.othercolumn.label('otherlabel')]) to label columns. in a related topic, if youre using use_labels, you can also address columns in the row based on the Column object directly:

Re: [Sqlalchemy-users] Resolving Ambiguous Column Names

2006-04-21 Thread Peter L. Buschman
I think I've answered my own question with the use_labels=True option to select(). ;-) At 17:33 21.4.06, Peter L. Buschman wrote: Most likely another newbie question, but how do I resolve an ambiguous column name that is present in two tables after a joing? For example, SQL lets me addres

[Sqlalchemy-users] Resolving Ambiguous Column Names

2006-04-21 Thread Peter L. Buschman
Most likely another newbie question, but how do I resolve an ambiguous column name that is present in two tables after a joing? For example, SQL lets me address the ambiguous column just by prefixing the table name. SELECT table1.colum, table2.column FROM table1 INNER JOIN table2 on table2.