We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 730689b commit 0b2017fCopy full SHA for 0b2017f
codeflash/after_db.py
@@ -0,0 +1,3 @@
1
+def get_authors(session):
2
+ query = session.query(Author).join(Book).distinct(Author.id).order_by(Author.id)
3
+ return query.all()
codeflash/before_db.py
@@ -0,0 +1,6 @@
+ books = session.query(Book).all()
+ _authors = []
4
+ for book in books:
5
+ _authors.append(book.author)
6
+ return sorted(list(set(_authors)), key=lambda x: x.id)
0 commit comments