_reset_exported() not safe to call on Table

Issue #3755 resolved
Mike Bayer repo owner created an issue
from sqlalchemy import *

m = MetaData()

t = Table('t', m, Column('foo', Integer))
print t.c

t._reset_exported()

print t.c
Traceback (most recent call last):
  File "test2.py", line 10, in <module>
    print t.c
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/util/langhelpers.py", line 754, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/selectable.py", line 689, in columns
    return self._columns.as_immutable()
AttributeError: 'Table' object has no attribute '_columns'

the ORM is calling this but i think that part should silently pass

Comments (3)

  1. Mike Bayer reporter

    Allow Table._reset_exported to silently pass

    Fixed bug in :class:.Table where the internal method _reset_exported() would corrupt the state of the object. This method is intended for selectable objects and is called by the ORM in some cases; an erroneous mapper configuration would could lead the ORM to call this on on a :class:.Table object.

    Change-Id: I63fa34ee0cdf16358bb125c556390df79758bcbc Fixes: #3755

    → <<cset 2c8643b0e980>>

  2. Mike Bayer reporter

    Allow Table._reset_exported to silently pass

    Fixed bug in :class:.Table where the internal method _reset_exported() would corrupt the state of the object. This method is intended for selectable objects and is called by the ORM in some cases; an erroneous mapper configuration would could lead the ORM to call this on on a :class:.Table object.

    Change-Id: I63fa34ee0cdf16358bb125c556390df79758bcbc Fixes: #3755 (cherry picked from commit 149fb5f55a5df3f31f6575919a5a5a2e5ba9cb0c)

    → <<cset a736be3feb4c>>

  3. Log in to comment