Ah, thanks very much, that's fixed it.  I must have missed that in the docs 
- I think this started out as a Python property and they later added the 
hybrid decorator.

On Thursday, December 19, 2019 at 4:34:34 PM UTC-4, YKdvd wrote:
>
> We have a "Users" model with this, which was a hybrid property to wrap the 
> "email" column temporarily.  The database column (MySQL 5.7)  is "email", 
> but defined by ORM as "_email", with an "email" hybrid property to access 
> and set:
>
> _email = Column(u'email', String(255))
> ...
>
> @hybrid_property
> def email(self):
>  return self._email.replace("olddomain.com", "newdomain.com")
> @email.setter
> def email_setter(self, val):
>  self._email = val
>
>
> In 1.1.18, something like "self.email = someEmailAddress" works fine.  We're 
> testing an upgrade to 1.3.11, and that now throws an "AttributeError: can't 
> set attribute" from hybrid.py __set__(). 
>
> That seems to be at a simple check "if self.fset is None", so it's almost as 
> if the decorator never stored the setter function?  I'm digging into the 
> hybrid docs, and it seems a pretty innocuous setter, but there might be 
> something about it that
>
> 1.3 is being stricter about?  I don't see any SAwarnings at startup that 
> might apply.  I changed the getter to simply return self._email in case that 
> was a problem, but that didn't help.
>
>

-- 
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/5b3e36b5-67d7-484b-aed9-2e4ae3ba94e6%40googlegroups.com.

Reply via email to