user1011332
user1011332

Reputation: 773

Mysql alchemy filter

I am trying to filter a query in mysql alchemy by doing something like this:

query_train = DBSession.query(TokenizedLabel).filter_by(which_disaster!=opts.disaster).all()

But it does not seem to work. Is there a way to filter a query where you are looking for somehting that is not equal to something else -> filter where which_disaster != "irene"

Thanks!

Upvotes: 2

Views: 261

Answers (1)

alecxe
alecxe

Reputation: 474003

filter_by() cannot handle not equal (!=), use filter() instead:

query_train = DBSession.query(TokenizedLabel).filter(TokenizedLabel.which_disaster!=opts.disaster).all()

Upvotes: 3

Related Questions