as the SQl is literal, u have to apply that advice by hand: SELECT crfItem.idCrf, class.name as clsname, attribute.name as attrname ... or something of sorts
On Monday 27 April 2009 19:00:24 Mauro wrote: > Dear group, > > I'm having the following issue with "Ambiguous column name", in > this situation: > > #code example begin > > connString = 'sqlite:///data/prosafelocal.sqlite' > engine = create_engine(connString) > connection = engine.connect() > query = 'SELECT crfItem.idCrf, crfItem.idClass, class.name, > attribute.id, attribute.name from crfItem JOIN class ON > crfItem.idClass = class.id JOIN attribute on class.id = > attribute.idClass WHERE crfItem.idCrf = 1' > > result = self.connection.execute(query, use_labels=True) > > #code end > > > I'm using connection.execute(query) directly with literal sql > syntax. I get the following error: > > "try 'use_labels' option on select statement." % colname) > InvalidRequestError: Ambiguous column name 'name' in result set! > try 'use_labels' option on select statement." > > The "name" column is present in two joint tables, and it generates > the ambiguity. > Anyway, it seems like the option "use_labels=True" does is not > affecting my query behaviour. > Any help would be really appreciated. > > Thanks, > Mauro > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---