Awesome that seems to fix it. Thanks Mike! On Wednesday, July 14, 2021 at 8:00:08 PM UTC-7 Mike Bayer wrote:
> fixed in master, please apply this patch: > > diff --git a/examples/vertical/dictlike-polymorphic.py > b/examples/vertical/dictlike-polymorphic.py > index 23a6e093d9..4c81af6d54 100644 > --- a/examples/vertical/dictlike-polymorphic.py > +++ b/examples/vertical/dictlike-polymorphic.py > @@ -83,7 +83,7 @@ class PolymorphicVerticalProperty(object): > for attribute, discriminator in pairs > if attribute is not None > ] > - return case(whens, self.cls.type, null()) > + return case(whens, value=self.cls.type, else_=null()) > > def __eq__(self, other): > return self._case() == cast(other, String) > > > > > On Wed, Jul 14, 2021, at 5:09 PM, I Jenkins wrote: > > Hi all, > > Does anyone else have problems when trying to run the > dictlike-polymorphic.py > <https://docs.sqlalchemy.org/en/14/_modules/examples/vertical/dictlike-polymorphic.html> > > example? With sqlalchemy 1.4.20 and python2.7 I'm getting this traceback: > ``` > 2021-07-14 14:04:25,847 INFO sqlalchemy.engine.Engine INSERT INTO > animal_fact (animal_id, "key", type, int_value, char_value, boolean_value) > VALUES (?, ?, ?, ?, ?, ?) > 2021-07-14 14:04:25,847 INFO sqlalchemy.engine.Engine [cached since > 0.01913s ago] ((2, 'cuteness', 'integer', 5, None, None), (2, 'poisonous', > 'boolean', None, None, 0), (2, 'weasel-like', 'boolean', None, None, 1), > (3, 'cuteness', 'integer', 5, None, None), (3, 'poisonous', 'boolean', > None, None, 1), (3, 'weasel-like', 'boolean', None, None, 0)) > 2021-07-14 14:04:25,848 INFO sqlalchemy.engine.Engine COMMIT > Traceback (most recent call last): > File "dictlike-polymorphic.py", line 222, in <module> > and_(AnimalFact.key == "weasel-like", AnimalFact.value == True) > File "lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line > 360, in __eq__ > return self.operate(eq, other) > File "lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line > 316, in operate > return op(self.comparator, *other, **kwargs) > File "dictlike-polymorphic.py", line 89, in __eq__ > return self._case() == cast(other, String) > File "dictlike-polymorphic.py", line 86, in _case > return case(whens, self.cls.type, null()) > File "<string>", line 2, in case > File "lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line > 2838, in __init__ > for (c, r) in whens > ValueError: too many values to unpack > ``` > Thanks, > Ian > > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/1bd90c8a-261e-4ff3-8285-0510dc4523fcn%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/1bd90c8a-261e-4ff3-8285-0510dc4523fcn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/175e9a9f-4e5a-4187-986a-56ea84a0169dn%40googlegroups.com.