On Jan 21, 2014, at 9:07 AM, Enrico Bottani <bei...@mac.com> wrote:

> Hello everybody,
> 
> I have a question about a query I'm trying to obtain.
> 
> I have three classes:
> 
> Unit  -->   QuestionUnit     --> VideoQuestionUnit
> 
> This is working fine with SQLAlchemy, what I'm struggling now is trying to 
> get only the QuestionUnits, but not the VideoQuestionUnit.
> 
> I would like to put a condition in this method:
>     questionUnits      = [i.serialize for i in 
> QuestionUnit.query.filter(QuestionUnit.brand_id == brandID).all()]
> 
> I have tried a lot of different things but never succeed,can someone please 
> point me in the right direction?

filter on the discriminator:

query(QuestionUnit).filter(QuestionUnit.type == ‘question_unit’)


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to