I have a QTableView connected to a QSqlRelationalTableModel. Everything works as expected, however, it seems to be impossible to have a sqlite3 generated column in my model:
bhd [INTEGER] GENERATED ALWAYS AS (round(d_mess * 130 / bhd_hoehe)) STORED
The above statement is the default way to add a generated column in sqlite3. But it does not appear in my model. When I change the column to a standard integer column, it's there. It does not matter if the generated column is of type STORED or VIRTUAL or if I omit the GENERATED ALWAYS keyword.
Is this by design? Or a sqlite3 driver problem?
Views seem not to be affected by this issue. I'm aware it's more a workaround than a solution, but you could create a dummy view just with your
foreign key
and the generated field.For example, I have a simple table
User
like this:As is, no
QSqlRelation
pointing toUser.full_name
will work, as you pointed out. However, I've created a simple view likeNow the following binding works fine
where
foreign_field
is the index ofUser.full_name
that in turn will be mapped as theUserFullNameView.full_name
field.