use_labels is a flag used by a select() construct. this is a literal text expression, so just label your "name" column something else, i.e. "class.name AS class_name".
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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
