[Sqlalchemy-tickets] [sqlalchemy] #2900: relationship aliased on subclass causes infinite recursion
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-01-01 16:31:20
|
#2900: relationship aliased on subclass causes infinite recursion
---------------------+-----------------------------------------
Reporter: scraper | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: orm | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
---------------------+-----------------------------------------
Having additional names for a relationship in a subclass works with
sqlalchemy <= 0.8.4
With 0.9.0 setting the attribute as seen below gives '''RuntimeError:
maximum recursion depth exceeded'''
{{{
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, ForeignKey
from sqlalchemy.orm import relationship, backref
Base = declarative_base()
class Child(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
foo_id = Column(Integer, ForeignKey('foo.id'))
foo = relationship('Foo', backref=backref('children'))
class FooChild(Child):
parent = Child.foo
class Foo(Base):
__tablename__ = 'foo'
id = Column(Integer, primary_key=True)
FooChild(parent=Foo())
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2900>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|