[sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative

2015-08-14 Thread Eric Atkin
Hi, I've written a class decorator to define a boilerplate __init__ on some of my models that inherit from a declarative_base superclass. The problem is that sqlalchemy.orm.instrumentation._generate_init() has already installed an __init__ and when I overwrite that, things break with object

Re: [sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative

2015-08-14 Thread Eric Atkin
(self, **kwargs): for k, v in self.licenses.items(): kwargs.setdefault('{}_license_rate'.format(k), v) orig_init(self, **kwargs) cls.__init__ = ___init__ On 8/14/15 2:41 AM, Eric Atkin wrote: Hi, I've written a class decorator to define

Re: [sqlalchemy] override relationship in subclass

2014-02-12 Thread Eric Atkin
12, 2014 7:17:08 AM UTC-7, Michael Bayer wrote: On Feb 11, 2014, at 9:38 PM, Eric Atkin eat...@certusllc.us javascript: wrote: Hi, I want to override a relationship in a subclass to relate to a subclass of the base attributes' related class. Perhaps an example of how I thought

Re: [sqlalchemy] override relationship in subclass

2014-02-12 Thread Eric Atkin
@gdelta.expression is a typo. Should be @delta.expression. On Wednesday, February 12, 2014 11:53:05 AM UTC-7, Eric Atkin wrote: Yeah sorry I missed that. conversion is an attribute on Measured_Source. So the intent is that a Production_Load is a Load with its own additional attributes over

[sqlalchemy] override relationship in subclass

2014-02-11 Thread Eric Atkin
Hi, I want to override a relationship in a subclass to relate to a subclass of the base attributes' related class. Perhaps an example of how I thought it should work: {{{ class Load(Base): __tablename__ = 'load' __mapper_args__ = { 'polymorphic_identity':'load',