RE: [sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread Jackson, Cameron
meron Sent: Monday, 16 January 2012 1:41 PM To: sqlalchemy@googlegroups.com Subject: RE: [sqlalchemy] Re: Initialize model by its primary key. Hmm, it's kind of hard to say whether the code you just posted is OK or not, without knowing what those 2 classes represent. It kind of looks to me

RE: [sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread Jackson, Cameron
> From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On > Behalf Of Jackson, Cameron > Sent: Monday, 16 January 2012 12:45 PM > To: sqlalchemy@googlegroups.com > Subject: RE: [sqlalchemy] Re: Initialize model by its primary key. > > You are correct that a

Re: [sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread Michael Bayer
On Jan 15, 2012, at 9:07 PM, gpitel wrote: > What you are saying makes perfect sense. Thank you for showing me the > light. The code below incorporates what I think you were saying and > allows me to still test it easily. Thanks again. A+++ for the > SQLAlchemy community!!! A+++ for Cameron

RE: [sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread Jackson, Cameron
@googlegroups.com Subject: RE: [sqlalchemy] Re: Initialize model by its primary key. You are correct that an object should initialise itself, but don't take that to mean that Test0 should be responsible for every use case where a Test0 is going to be created. If you need some logic that says

RE: [sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread Jackson, Cameron
You are correct that an object should initialise itself, but don't take that to mean that Test0 should be responsible for every use case where a Test0 is going to be created. If you need some logic that says, for example, 'If a Test0 already exists with id x, then return it, otherwise create a n