Have you confirmed that you can connect to 127.0.0.1 at port 5432 using 
psql? On my development system, I normally use a local (UNIX domain) 
socket, which is libpq's default behavior. When I run "psql -h 127.0.0.1", 
I get the following error:

psql: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?

On Tuesday, June 15, 2021 at 1:06:23 PM UTC-4 Ryan Bandler wrote:

> Hello everyone,
>
> I am a first-time SQLalchemy user planning on using SQLalchemy on a new 
> project. We already have an established postgres database (currently still 
> on localhost) which I do not want to handwrite the SQLalchemy model for. So 
> I am planning to use sqlacodegen. Unfortunately, sqlacodegen is giving me:
>
> sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not 
> connect to server: Connection refused
>         Is the server running on host "localhost" (127.0.0.1) and accepting
>         TCP/IP connections on port 5432?
>
> My systems at work are very restrictive, but I was able to gain 
> permissions to the postgres config files and edited them to allow all TCP 
> connections. I restarted the postgres service and I am still experiencing 
> this error. I dont understand why this is happening, because it seems to be 
> an error coming from psycopg2 being called in sqlalchemy, and i have ever 
> had any issues connecting to the DB with psycopg2 before. 
>
> If anyone has any experience with sqlacodegen, any help would be much 
> appreciated!!
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/3179b853-7b73-462e-85c7-5ef3c4995f17n%40googlegroups.com.

Reply via email to