O'Reilly logo

PySide GUI Application Development by Venkateshwaran Loganathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Viewing relations in table views

The main feature of relational database is its ability to relate one or more tables. One such relating feature is the use of foreign key concept where a primary key of a table is related to a column in another table. This relation can be easily exhibited using QRelationalTableModel. In order to explain this, we create three tables that are connected to each other. The schema is defined as follows:

CREATE TABLE employee (id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, name VARCHAR(40) NOT NULL, department INTEGER, branch INTEGER) CREATE TABLE department (id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, name VARCHAR(20) NOT NULL, FOREIGN KEY(id) REFERENCES employee) CREATE TABLE branch (id INTEGER PRIMARY ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required