On Fri, Feb 19, 2016 at 9:30 PM, <[email protected]> wrote: > My company is in the process of upgrading one of our applications from > SQLAlchemy 0.9 to 1.0.12. The process is mostly complete but we are getting > exceptions seemingly at random for some of our more complicated queries. > > The relevant stack trace: > > File > "/home/bill/.virtualenvs/rrwr-sqla/lib/python2.7/site-packages/sqlalchemy/orm/query.py", > line 2588, in all > return list(self) > File > "/home/bill/.virtualenvs/rrwr-sqla/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", > line 86, in instances > util.raise_from_cause(err) > File > "/home/bill/.virtualenvs/rrwr-sqla/lib/python2.7/site-packages/sqlalchemy/util/compat.py", > line 200, in raise_from_cause > reraise(type(exception), exception, tb=exc_tb, cause=cause) > File > "/home/bill/.virtualenvs/rrwr-sqla/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", > line 74, in instances > for row in fetch] > > The issue seems to be occurring for queries where we use the add_entity() > method > to select a declarative model entity when a column from the same table is > already in the query constructor and labeled. > > If I remove the label or change the column expression in the query > constructor to use literal_column().label() to reference the column > expression for the same column as added by add_entity() then everything > seems to work. > > My best guess is that it's caused by the dict assignment here > <https://bitbucket.org/zzzeek/sqlalchemy/src/c97aa63789036fc145503f03123275253ae02d2c/lib/sqlalchemy/orm/query.py?at=master&fileviewer=file-view-default#query.py-148> > overwriting > the unlabeled column but I could be way off. > > Is this a bug in SQLAlchemy or is there a better supported method of > handling this sort of query? >
this stack trace does not show the actual error you're getting nor do I know what you refer to when you say "this sort of query", so unfortunately I can't make any guesses as to what's going on. The best way to identify what is happening here is if you provide an MCVE ( http://stackoverflow.com/help/mcve) that reproduces the issue. > > I don't know if this is relevant but I'm connecting to MS SQL Server via > pymssql. > > Thanks, > Bill > > -- > 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 https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
