[sqlalchemy] Enum referencing column

2015-10-29 Thread drMental
How do I get this use case working? I want the ticker attribute to retrieve the values from the value defined in the Enum column. class Security(Base): cusip = Column(String) sedol = Column(String) isin = Column(String) symbol = Column(String) _ticker =

[sqlalchemy] Re: Enum referencing column

2015-10-29 Thread drMental
Never mind, the hybrid_property was needed not declared_attr. My bad. On Thursday, 29 October 2015 11:46:32 UTC-7, drMental wrote: > > How do I get this use case working? I want the ticker attribute to > retrieve the values from the value defined in the Enum column. > > > class Security(Base):

Multi-column foreign key constrait using postgresql, autogenerated migration fails

2015-10-29 Thread Gastón Avila
Hi all, I used alembic to generate (auto) a migration which added a table to my postgresql DB which had a foreign key constraint matching two columns in the new table to two columns in an existing one. The two columns in the existing table where a joint primary key (hence unique). The

[sqlalchemy] Created edge-case bug with `contains_eager`, can't reproduce

2015-10-29 Thread Jonathan Vanasco
I've spent an hour trying to reproduce this bug and can't. I'm hoping someone can suggest what might be going on so I can make this reproducable for a bug report I have 2 classes: class Foo(Base): __tablename__ = 'foo' id = Column(Integer, primary_key=True) bar_id

Re: [sqlalchemy] Created edge-case bug with `contains_eager`, can't reproduce

2015-10-29 Thread Mike Bayer
On 10/29/15 6:50 PM, Jonathan Vanasco wrote: > I've spent an hour trying to reproduce this bug and can't. I'm hoping > someone can suggest what might be going on so I can make this > reproducable for a bug report > > I have 2 classes: > > class Foo(Base): > __tablename__ = 'foo'

Re: Multi-column foreign key constrait using postgresql, autogenerated migration fails

2015-10-29 Thread Mike Bayer
On 10/29/15 4:26 PM, Gastón Avila wrote: > Hi all, > > I used alembic to generate (auto) a migration which added a table to my > postgresql DB which had a foreign key constraint matching two columns in > the new table to two columns in an existing one. The two columns in the > existing table

Re: [sqlalchemy] Created edge-case bug with `contains_eager`, can't reproduce

2015-10-29 Thread Jonathan Vanasco
On Thursday, October 29, 2015 at 7:33:47 PM UTC-4, Michael Bayer wrote: > > i dont have an immediate answer, though i wonder why you aren't using > ~Bar.is_x.is(True) for that "IS NOT"... > Old habits and styleguide. The `~` ended up being missed on too many glances and code-reviews. >

Re: How can I use ExecuteSQLOp?

2015-10-29 Thread Jacob Magnusson
Thanks for pointing me in the right direction @zzzeek. For me it worked really well to just add these lines to *alembic.autogenerate.render*: @renderers.dispatch_for(ops.ExecuteSQLOp) def _execute_sql(autogen_context, op): assert isinstance(op.sqltext, str) return