aboutsummaryrefslogtreecommitdiffstats
path: root/examples/sql/books
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 10:09:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 13:21:52 +0200
commitdf43156bb35a442c4988631e1c2b0bd0fc11e618 (patch)
tree77e6c531967013e5628f04e48ba035197b8a737c /examples/sql/books
parent130e79e4658d2438f66ab8aeb5e186349e3cb740 (diff)
Examples: Fix some space-related flake warnings
Task-number: PYSIDE-1112 Change-Id: Ib8991199e4822673d6a25cba0023dbe3b03f5938 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/sql/books')
-rw-r--r--examples/sql/books/bookwindow.py2
-rw-r--r--examples/sql/books/createdb.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/examples/sql/books/bookwindow.py b/examples/sql/books/bookwindow.py
index ff99cbbbc..0b6cc5f44 100644
--- a/examples/sql/books/bookwindow.py
+++ b/examples/sql/books/bookwindow.py
@@ -55,7 +55,7 @@ class BookWindow(QMainWindow, Ui_BookWindow):
super().__init__()
self.setupUi(self)
- #Initialize db
+ # Initialize db
createdb.init_db()
model = QSqlRelationalTableModel(self.bookTable)
diff --git a/examples/sql/books/createdb.py b/examples/sql/books/createdb.py
index 524ee0daf..d1f624ae0 100644
--- a/examples/sql/books/createdb.py
+++ b/examples/sql/books/createdb.py
@@ -41,6 +41,7 @@
from PySide6.QtSql import QSqlDatabase, QSqlQuery
from datetime import date
+
def add_book(q, title, year, authorId, genreId, rating):
q.addBindValue(title)
q.addBindValue(year)
@@ -62,6 +63,7 @@ def add_author(q, name, birthdate):
q.exec_()
return q.lastInsertId()
+
BOOKS_SQL = """
create table books(id integer primary key, title varchar, author integer,
genre integer, year integer, rating integer)
@@ -83,6 +85,7 @@ INSERT_BOOK_SQL = """
values(?, ?, ?, ?, ?)
"""
+
def init_db():
"""
init_db()
@@ -109,12 +112,12 @@ def init_db():
greeneId = add_author(q, "Graham Greene", date(1904, 10, 2))
pratchettId = add_author(q, "Terry Pratchett", date(1948, 4, 28))
- check(q.prepare,INSERT_GENRE_SQL)
+ check(q.prepare, INSERT_GENRE_SQL)
sfiction = add_genre(q, "Science Fiction")
fiction = add_genre(q, "Fiction")
fantasy = add_genre(q, "Fantasy")
- check(q.prepare,INSERT_BOOK_SQL)
+ check(q.prepare, INSERT_BOOK_SQL)
add_book(q, "Foundation", 1951, asimovId, sfiction, 3)
add_book(q, "Foundation and Empire", 1952, asimovId, sfiction, 4)
add_book(q, "Second Foundation", 1953, asimovId, sfiction, 3)