You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
358 B
Python

5 years ago
from calibrestekje import Book, Publisher, init_session
session = init_session("sqlite:///metadata.db")
publisher = (session.query(Publisher)
.filter(Publisher.name == "MIT Press").one())
books = (session.query(Book)
.filter(Book.publishers.contains(publisher)))
print(f"Books published by MIT Press: {books.count()}")