Awesome, thanks Mike! Looking forward to the release.
Damon On Friday, February 23, 2018 at 11:20:33 AM UTC-8, Mike Bayer wrote: > > On Fri, Feb 23, 2018 at 1:38 PM, Mike Bayer <mik...@zzzcomputing.com > <javascript:>> wrote: > > *perfect* test case, I'll get a bug report up and can fix this quickly, > thanks! > > here's the issue: > > https://bitbucket.org/zzzeek/sqlalchemy/issues/4199/selectin-polymorphic-hitting-expanding-in > > > here's the patch: > https://gerrit.sqlalchemy.org/#/c/zzzeek/sqlalchemy/+/678 > > thanks! > > > > > > On Fri, Feb 23, 2018 at 1:26 PM, Damon Doucet <da...@benchling.com > <javascript:>> wrote: > >> Hey all, > >> > >> Loving the new selectin stuff. I think we've hit a bug with > >> polymorphic_load=selectin. I've posted a small repro at the bottom. > >> > >> The crash we're seeing is: > >> > >> sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) > >> 'expanding' parameters can't be used with an empty list [SQL: u'SELECT > a1.id > >> AS a1_id, a.id AS a_id, a.type AS a_type \nFROM a JOIN a1 ON a.id = > a1.id > >> \nWHERE a.id IN ([EXPANDING_primary_keys]) ORDER BY a.id'] > [parameters: > >> [{'primary_keys': []}]] > >> > >> A few interesting points: > >> > >> - Uncommenting L2 => no crash > >> - Commenting L1 or L3 => no crash > >> > >> Let me know if there's anything more I can do to clarify/help. > >> > >> > >> Thanks! > >> Damon > >> > >> > >> > >> from sqlalchemy import * > >> from sqlalchemy.orm import * > >> from sqlalchemy.ext.declarative import declarative_base > >> from sqlalchemy import event > >> > >> Base = declarative_base() > >> > >> > >> class A(Base): > >> __tablename__ = 'a' > >> id = Column(Integer, primary_key=True) > >> type = Column(String) > >> b_id = Column(ForeignKey('b.id')) > >> > >> __mapper_args__ = { > >> 'polymorphic_on': type, > >> } > >> > >> > >> class A1(A): > >> __tablename__ = 'a1' > >> id = Column(Integer, ForeignKey('a.id'), primary_key=True) > >> __mapper_args__ = { > >> 'polymorphic_identity': 'a1', > >> 'polymorphic_load': 'selectin', > >> } > >> > >> > >> class A2(A): > >> __tablename__ = 'a2' > >> id = Column(Integer, ForeignKey('a.id'), primary_key=True) > >> __mapper_args__ = { > >> 'polymorphic_identity': 'a2', > >> 'polymorphic_load': 'selectin', > >> } > >> > >> > >> class B(Base): > >> __tablename__ = 'b' > >> id = Column(Integer, primary_key=True) > >> a_list = relationship('A') > >> > >> > >> e = create_engine("sqlite://", echo=True) > >> Base.metadata.create_all(e) > >> > >> s = Session(e) > >> > >> b = B(a_list=[A1(), A2()]) > >> s.add(b) > >> s.info['foo'] = b.a_list[0] # L1 > >> # s.info['bar'] = b.a_list[1] # L2 > >> s.commit() # L3 > >> > >> print b.a_list # crashes > >> > >> -- > >> SQLAlchemy - > >> The Python SQL Toolkit and Object Relational Mapper > >> > >> http://www.sqlalchemy.org/ > >> > >> To post example code, please provide an MCVE: Minimal, Complete, and > >> Verifiable Example. See http://stackoverflow.com/help/mcve for a full > >> description. > >> --- > >> You received this message because you are subscribed to the Google > Groups > >> "sqlalchemy" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to sqlalchemy+...@googlegroups.com <javascript:>. > >> To post to this group, send email to sqlal...@googlegroups.com > <javascript:>. > >> Visit this group at https://groups.google.com/group/sqlalchemy. > >> For more options, visit https://groups.google.com/d/optout. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.