| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
|---|---|
| To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Database issues when adding GUI |
| Date: | 2021-06-07 17:19:42 |
| Message-ID: | f4c2c51e-675e-3cf8-c06b-3091fe903e0b@aklaver.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 6/7/21 9:00 AM, Rich Shepard wrote:
> On Mon, 7 Jun 2021, Adrian Klaver wrote:
>
>> What Philip is suggesting is to use Python only simple script to
>> connect to database and retrieve from table. Something like:
>>
>> import psycopg2
>>
>> con = psycopg2.connect(<connection_str>)
>> cur = con.cursor()
>> cur.execute('select * from activitytypes')
>> rs = cur.fetchall()
>> print(rs)
>
> Adrian,
>
>>>> con = psycopg2.connect(bustrac)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'bustrac' is not defined
No this is because you did not use an actual connection string e.g:
psycopg2.connect("host=salmo user=rshepard dbname=bustrac")
Instead you used an undefined variable bustrac per the error message:
NameError: name 'bustrac' is not defined
>
> That's because there's a problem with connecting to the database. See my
> reply to Rob's message.
>
> Thanks,
>
> Rich
>
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2021-06-07 17:20:03 | Re: Database issues when adding GUI |
| Previous Message | David G. Johnston | 2021-06-07 16:42:07 | Re: Database issues when adding GUI |