mapper compile_pks/reduce columns has an ordering dependency w/ declarative

Issue #1161 resolved
Mike Bayer repo owner created an issue
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

# move "Bar" below "Foo" to resolve the issue
class Bar(Base):
    __tablename__ = 'bar'

    id = sa.Column(sa.Integer, sa.ForeignKey("foo.id"), primary_key=True)
    ex = sa.Column(sa.Integer, primary_key=True)

class Foo(Base):
    __tablename__ = 'foo'

    id = sa.Column(sa.Integer, primary_key=True)
    bars = orm.relation(Bar)

Comments (2)

  1. Log in to comment