I use this recipe extensively (and have for several years), can you provide a test case that generates that warning?
On May 27, 2013, at 9:01 PM, John Anderson <[email protected]> wrote: > I'm trying to adopt the examples from: > > https://bitbucket.org/zzzeek/sqlalchemy/src/e2b8c893ca98/examples/dogpile_caching/ > > to work with my code base and so I've copy and pasted the caching_query.py > into my project and started doing queries like this: > > > DBSession = scoped_session( > sessionmaker(query_cls=query_callable(regions)) > ) > > > def get_user_by_username(session, username, with_profile=True): > query = session.query(User).filter( > User.username == username > ).options(FromCache("default")) > > if with_profile: > query = query.options( > joinedload('profile') > , RelationshipCache(User.profile) > ) > > user = query.one() > > return user > > > > The first problem I see is now its complaining about conflicting column names: > > /home/sontek/.virtualenvs/notaliens3/src/notaliens.com/eggs/SQLAlchemy-0.8.1-py3.3.egg/sqlalchemy/sql/expression.py:2471: > SAWarning: Column 'pk' on table <sqlalchemy.sql.expression.Select at > 0x7fdd7af2e2d0; Select object> being replaced by another column with the same > key. Consider use_labels for select() statements. > self[column.key] = column > > > I was able to fix this by adding _with_labels = True to the CachingQuery code > but not sure if that is the best place to do that. > > Without the caching query it was generating the labels correctly. > > > The only other problem I had with the example was that it is using unicode() > which isn't python3 compatible but that was also a pretty easy fix. > > > > Thanks for the example! Is there a reason it has to live in examples rather > than being a part of SQLAlchemy or a 3rd glue package? It seems to work well > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
