PyQt5: specifying QSqlTableModel

Tomas Sobota tom at sobota.net
Sat Jun 5 17:45:49 BST 2021


Rich,
I just tested Colin's database and both source files and it works on my
machine (Linux Mint,  Python 3.9.4)
Is your database available to have a look at it?
Tom


On Sat, Jun 5, 2021 at 6:34 PM Colin McPhail <colin.mcphail at mac.com> wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210605/3ef712ca/attachment.htm>


More information about the PyQt mailing list