On Wed, Feb 5, 2014 at 7:28 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:
> > OK great, added some more rules in 5c188f6c1ce85eaace27f052. > Awesome, thanks! My tests all passed on my end. As far as “names line up with the result set names”, I’m not sure what you > mean there, the .columns() method is always matching up names. With that > checkin, all the tests in your sample suite pass, so feel free to give it a > check, I’d like to get this totally right for when 0.9.3 comes out. > Gotcha: I thought that even querying a plain text() object would give you the right ORM objects back as long as the columns were in the right positional order. Looks like that's not the case, which is probably for the best; I think the more liberal behavior would have a large risk of causing silent bugs. As for *why* I thought that: I didn't realize until just now that ORM is designed to handle labels when they're in the specific form <tablename>_<columnname>. That's why I thought a text query with result set names in that form was being mapped by position, because I didn't know ORM was smart enough to find columns by name in that form :) I wrote one more test that failed (but I'm pretty sure it doesn't matter): I was under the impression that passing Label objects to .columns() would allow you to map *arbitrary* result set column names to ORM attributes, and that seems to not be the case (and was never the case, AFAIK). That kind of mapping would be cool, and might not even be that hard since the columns in the RowProxy ._keymap values seem to have the original ORM columns in their .proxy_sets. That said, the only reason I can think of for someone to try that is if they did something truly nuts like a join with two columns with the same name from two tables which *also* have the same name, from two different schemas, with a stored procedure, into ORM. As long as the <tablename>_<columname> form works, I think our use case is covered, so feel free to say wontfix. But if you're interested, I added the new test to my suite: https://gist.github.com/garaden/8835587 I hope I'm not harassing you too much about the TextAsFrom feature! I feel like if I asked any other ORM to be this flexible they would either laugh or cry. SQLAlchemy is the first ORM I've worked with since using Rails as an intern, and I'm spoiled now with how awesome it is :) -Matt -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.