[sqlalchemy] how to model a collection of different types/classes using declarative

2014-11-17 Thread nathan
Sorry if I’m missing something basic and/or pretty obvious but I don’t know how to model collections of different types/classes. For example, let’s say I have these base types/classes: class Chicken(Base): __tablename__ = ‘chicken' id = Column(Integer, primary_key=True) name = Colu

Re: [sqlalchemy] Compound unique constraint with a nullable column

2014-11-17 Thread Michael Bayer
> On Nov 17, 2014, at 1:55 PM, Guido Winkelmann > wrote: > > > Am Montag, 17. November 2014 16:25:54 UTC+1 schrieb Michael Bayer: > >> On Nov 17, 2014, at 7:37 AM, Guido Winkelmann >> > wrote: >> >> Hi, >> >> How can I go about having a cross-platform compatible compound unique >> constra

Re: [sqlalchemy] Compound unique constraint with a nullable column

2014-11-17 Thread Guido Winkelmann
Am Montag, 17. November 2014 16:25:54 UTC+1 schrieb Michael Bayer: > > > On Nov 17, 2014, at 7:37 AM, Guido Winkelmann < > gu...@ambient-entertainment.de > wrote: > > Hi, > > How can I go about having a cross-platform compatible compound unique > constraint over two columns where there can be onl

Re: [sqlalchemy] Compound unique constraint with a nullable column

2014-11-17 Thread Michael Bayer
> On Nov 17, 2014, at 7:37 AM, Guido Winkelmann > wrote: > > Hi, > > How can I go about having a cross-platform compatible compound unique > constraint over two columns where there can be only one record with NULL in > one column and a given value in the other? > > I want something like thi

[sqlalchemy] Compound unique constraint with a nullable column

2014-11-17 Thread Guido Winkelmann
Hi, How can I go about having a cross-platform compatible compound unique constraint over two columns where there can be only one record with NULL in one column and a given value in the other? I want something like this: UniqueConstraint("parent_id", "name") except "parent_id" is nullable, an