1. Michael Bayer
  2. sqlalchemy
  3. Issues

Issues

Issue #2815 resolved

any way to detect this cycle?

Michael Bayer
repo owner created an issue

also why does it happen with append_whereclause, but not where?

from sqlalchemy import *
from sqlalchemy.sql import table, column

t = table('t', column('x'))

s = select([t](t))

s = s.append_whereclause(s.c.x > 5)

print s

Comments (4)

  1. Michael Bayer reporter

    eh? maybe

    diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
    index e06262c..3ee0bfb 100644
    --- a/lib/sqlalchemy/sql/selectable.py
    +++ b/lib/sqlalchemy/sql/selectable.py
    @@ -1936,6 +1936,8 @@ class Select(HasPrefixes, SelectBase):
    
             def add(items):
                 for item in items:
    +                if item is self:
    +                    raise exc.InvalidRequestError("boom")
                     if translate and item in translate:
                         item = translate[item](item)
                     if not seen.intersection(item._cloned_set):
    
  2. Log in to comment