pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philip Semanchuk <philip@americanefficient.com>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Database issues when adding GUI
Date: Mon, 7 Jun 2021 11:21:42 -0400
Message-ID: <34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com> (raw)
In-Reply-To: <48392c33-d63e-15be-e7de-d7a7c0c2fd80@gmail.com>
References: <alpine.LNX.2.20.2106070748380.1822@salmo.appl-ecosys.com>
	<48392c33-d63e-15be-e7de-d7a7c0c2fd80@gmail.com>



> On Jun 7, 2021, at 11:07 AM, Rob Sargent <robjsargent@gmail.com> wrote:
> 
> On 6/7/21 9:02 AM, Rich Shepard wrote:
>> This is an unusual message and I hope someone(s) here can offer insights
>> into the cause of the problem I've been wrestling with for the past couple
>> of weeks.
>> 
>> Context: For the past decade I've run my business tracking database from the
>> psql shell (currently with postgresql-12.2) and decided it's time to add a
>> frontend so it's a stand-alone desktop application. I'm learning to use
>> PyQt5 as the widget set and application framework.
>> 
>> The database contains three lookup tables: activitytypes, industrytypes, and
>> statustypes, all have a single column and few rows. So I've started with
>> these to get python3 and PyQt5-5.13.2 to run the SELECT query and display
>> the results in a QTableView.
>> 
>> The problem with all three is that my code produces an empty window and
>> hangs. There's no python error displayed and the application reports finding
>> the database but not the tables. For example, the activitytypes debugging
>> log contains:
>> INFO:root:found database
>> DEBUG:root:Defining model/view
>> DEBUG:root:model error:  Unable to find table activitytypes
>> DEBUG:root:about to execute select query
>> DEBUG:root:End of Program
>> 
>> I, and others on the python and pyqt mail lists and stackoverflow, can find
>> nothing wrong with the python code. This suggests it's something with the
>> database itself. But I have no idea where to look. The database structure
>> is:
>> 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
>> (10 rows)
>> 
>> What might stop a front-end application from finding a table that has been
>> readily accessed from the psql shell?
>> 
>> All suggestions and recommendations are needed.
>> 
>> TIA,
>> 
>> Rich
>> 
>> \
> This looks like a permissions problem, as though you are connecting as a role/user without permission to select from the tables.

I agree with Rich. Permissions, or you’re connecting as the wrong user. You might find it helpful to simplify and not use a GUI application until you get your connection issues sorted out. A simple command line Python app that connects to the database and prints the result of “select * from activitytypes limit 1” will enable quick(er) debugging of your connection issues.

Cheers
Philip






view thread (54+ messages)  latest in thread

Message-ID: <34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com>
Permalink:  ../34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com/
Also on:    postgresql.org/message-id/34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: philip@americanefficient.com, robjsargent@gmail.com
  Subject: Re: Database issues when adding GUI
  In-Reply-To: <34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com>
  References: <alpine.LNX.2.20.2106070748380.1822@salmo.appl-ecosys.com> <48392c33-d63e-15be-e7de-d7a7c0c2fd80@gmail.com> <34B90F57-654D-4170-A7E9-613EB40A952C@americanefficient.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox