auto-correlation regression regarding eager load, column prop, eg. the usual suspects
Issue #2530
resolved
appeared some time in 0.7:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class SnortEvent(Base):
__tablename__ = "event"
id = Column(Integer, primary_key=True)
signature = Column(Integer, ForeignKey("signature.id"))
signatures = relationship("Signature", lazy=False)
class Signature(Base):
__tablename__ = "signature"
id = Column(Integer, primary_key=True)
sig_count = column_property(
select([func.count('*')](func.count('*'))).\
where(SnortEvent.signature == id)
)
# workaround
#Signature.sig_count = column_property(
# select([func.count('*')](func.count('*'))).\
# where(SnortEvent.signature == Signature.id).\
# correlate(Signature.__table__)
# )
session = Session()
print session.query(SnortEvent)
sqlalchemy.exc.InvalidRequestError: Select statement 'SELECT count(:param_1) AS count_1
FROM event, signature AS signature_1
WHERE event.signature = signature_1.id' returned no FROM clauses due to auto-correlation; specify correlate(<tables>) to control correlation manually.
Comments (4)
-
reporter -
reporter yeah so if you just undo the smallest part of
#2261:--- a/lib/sqlalchemy/sql/expression.py Thu Jul 05 10:19:59 2012 -0400 +++ b/lib/sqlalchemy/sql/expression.py Sun Jul 08 14:58:55 2012 -0400 @@ -4807,7 +4807,7 @@ _SelectBase.__init__(self, **kwargs) - @property + @util.memoized_property def _froms(self): # would love to cache this, # but there's just enough edge cases, particularly now that
then it's fine. but it's really working by accident there.
-
reporter - changed status to wontfix
-
reporter - removed milestone
Removing milestone: 0.7.9 (automated comment)
- Log in to comment
appeared in 0.7.3