PyQt5: specifying QSqlTableModel
Colin McPhail
colin.mcphail at mac.com
Sat Jun 5 17:34:32 BST 2021
Rich,
> On 5 Jun 2021, at 16:24, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>
> Now: your food database displays the requested table in a QTableView. My
> database does not display the activitytypes in a QTableView; only a blank
> window. 'diff -y' shows no differences other than the names of the databases
> and the tables.
>
> Attached is a ZIPped file with the two .py files and the two .log files. The
> log file says it cannot find the table 'activitytypes' but it is in the
> database:
> bustrac=# \d
> List of relations
> Schema | Name | Type | Owner --------+---------------------------+----------+----------
> public | activities | table | rshepard
> public | activitytypes | table | rshepard
> public | industrytypes | table | rshepard
> public | locations | table | rshepard
> public | organizations | table | rshepard
> public | organizations_org_nbr_seq | sequence | rshepard
> public | people | table | rshepard
> public | people_person_nbr_seq | sequence | rshepard
> public | projects | table | rshepard
> public | statustypes | table | rshepard
>
> I am not seeing why that table is not seen.
>
Now that the Sqlite database table is getting displayed for you I fear I am at the end of my ability to help since I've never used anything other than Sqlite databases.
However, I do notice that the list of tables in your database has a column called 'Owner.' Do you think that in datasource.py you should use the version of open() that takes a username and password? If that's not relevant you could maybe ask for ideas on StackOverflow if you haven't already.
--
Colin
More information about the PyQt
mailing list