Retrieving the results from a table using SQLAlchemy

How can I print the results returned by session.query(User.name).filter(User.gender != 'male')

This will return all the male candidates in the table. I want to print name of each candidate seperately. Do I need to include a for loop for this?

Answers


From official documentation

>>> for instance in session.query(User).order_by(User.id): 
...     print instance.name, instance.fullname
ed Ed Jones
wendy Wendy Williams
mary Mary Contrary
fred Fred Flinstone

Need Your Help

Extracting all links of a certain form

regex arrays perl html-tree

I've got a page that I want all the links off of (e.g. http://www.stephenfry.com/). I want to put all the links that are of the form http://www.stephenfry.com/WHATEVER into an array. What I've got ...

double click a file to run python script. how to get that file as an input?

python macos file input operating-system

I want to be able to create a program that can save text files with my own extension at the end. later the user should be able to double click on that file to run the program and open that file.