Re: [sqlalchemy] How to define a column property for whether model is the latest of a one-to-many relationship

2018-11-07 Thread phil . nachum
Seems to work great. Thanks so much! On Wednesday, November 7, 2018 at 11:33:11 AM UTC-8, Mike Bayer wrote: > > On Wed, Nov 7, 2018 at 1:05 PM > > wrote: > > > > I need help with structuring the query too. I can implement a query with > raw SQL, but it involves subqueries, and I'm not sure

Re: [sqlalchemy] How to define a column property for whether model is the latest of a one-to-many relationship

2018-11-07 Thread Mike Bayer
On Wed, Nov 7, 2018 at 1:05 PM wrote: > > I need help with structuring the query too. I can implement a query with raw > SQL, but it involves subqueries, and I'm not sure how to translate it to a > column property (or if there's a better way which would avoid the need for a > subquery

Re: [sqlalchemy] How to define a column property for whether model is the latest of a one-to-many relationship

2018-11-07 Thread phil . nachum
I need help with structuring the query too. I can implement a query with raw SQL, but it involves subqueries, and I'm not sure how to translate it to a column property (or if there's a better way which would avoid the need for a subquery entirely) On Wednesday, November 7, 2018 at 9:54:15 AM

Re: [sqlalchemy] How to define a column property for whether model is the latest of a one-to-many relationship

2018-11-07 Thread Mike Bayer
On Wed, Nov 7, 2018 at 12:33 PM wrote: > > I have the following two models > > class Dataset(db.Model): > __tablename__ = 'datasets' > > id = db.Column(db.Integer, primary_key=True) > creation_datetime = db.Column(db.DateTime(timezone=False), nullable=False) > > sample_id =

[sqlalchemy] How to define a column property for whether model is the latest of a one-to-many relationship

2018-11-07 Thread phil . nachum
I have the following two models class Dataset(db.Model): __tablename__ = 'datasets' id = db.Column(db.Integer, primary_key=True) creation_datetime = db.Column(db.DateTime(timezone=False), nullable= False) sample_id = db.Column(db.Integer, db.ForeignKey('samples.id'), nullable=