Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list
hi Damon - this week preferably tomorrow - mike On Mon, Mar 5, 2018 at 1:50 PM, wrote: > Hey Mike, > > Noticed 1.2.5 doesn't have a release date yet on > http://docs.sqlalchemy.org/en/latest/changelog/changelog_12.html#change-1.2.2. > Was wondering if that could be released sometime soon - we're blocked from > switching over until it's released. > > > Damon > > > On Friday, February 23, 2018 at 12:47:13 PM UTC-8, da...@benchling.com > wrote: >> >> 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 >>> 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 >>> > 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. >>> >> To post to this group, send email to sqlal...@googlegroups.com. >>> >> 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. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper h
Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list
Hey Mike, Noticed 1.2.5 doesn't have a release date yet on http://docs.sqlalchemy.org/en/latest/changelog/changelog_12.html#change-1.2.2. Was wondering if that could be released sometime soon - we're blocked from switching over until it's released. Damon On Friday, February 23, 2018 at 12:47:13 PM UTC-8, da...@benchling.com wrote: > > 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 >> 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 >> 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. >> >> To post to this group, send email to sqlal...@googlegroups.com. >> >> 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.
Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list
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 > 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 > 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 . > >> To post to this group, send email to sqlal...@googlegroups.com > . > >> 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.
Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list
On Fri, Feb 23, 2018 at 1:38 PM, Mike Bayer 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 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+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. -- 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.
Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list
*perfect* test case, I'll get a bug report up and can fix this quickly, thanks! On Fri, Feb 23, 2018 at 1:26 PM, Damon Doucet 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+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. -- 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.