Working with QSqlTableModel
Learn how we use the QSqlTableModel to create GUI applications.
We'll cover the following
Creating the application
Now, a GUI for visualizing the database's contents will be developed. The QSqlTableModel
class, is an interface that is useful for reading and writing database records when you only need to use a single table without linkages to other databases. We will only visualize the accounts table in this table. The following program will show you how to inspect a SQL database's contents using model/view programming. We could use QSqlQuery
to handle all database-related tasks, but combining the class with PyQt's model/view paradigm enables us to create graphical user interfaces (GUIs) that streamline the data management process.
We start by importing the required modules.
Get hands-on with 1400+ tech skills courses.