Re: [sqlalchemy] Re: Connection error
On Wed, 16 Jun 2021, Ryan Bandler wrote: Yeah I connect to the DB over localhost:5432 via psql all the time and also haven't had any issues connecting via psycopg2. I also have no issue connecting to the database in sqlalchem, it's only an issue with sqlacodegen. Ryan, Just to confirm, you're running sqlacodegen from the OS shell and not from the python REPL, correct? Rich -- 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/alpine.LNX.2.20.2106160808450.6174%40salmo.appl-ecosys.com.
[sqlalchemy] Re: Connection error
Anyways guys I was able to fix the issue by installing a flask-specific version of the same package (even though I am not using flask) and I was able to get it to work just fine. Thanks everyone for your help. On Wednesday, June 16, 2021 at 9:20:37 AM UTC-4 Ryan Bandler wrote: > Yeah I connect to the DB over localhost:5432 via psql all the time and > also haven't had any issues connecting via psycopg2. I also have no issue > connecting to the database in sqlalchem, it's only an issue with > sqlacodegen. > On Tuesday, June 15, 2021 at 7:53:51 PM UTC-4 jonatha...@gmail.com wrote: > >> 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/ef5f8cda-983b-4657-9020-ad6be4201522n%40googlegroups.com.
[sqlalchemy] Re: Connection error
Yeah I connect to the DB over localhost:5432 via psql all the time and also haven't had any issues connecting via psycopg2. I also have no issue connecting to the database in sqlalchem, it's only an issue with sqlacodegen. On Tuesday, June 15, 2021 at 7:53:51 PM UTC-4 jonatha...@gmail.com wrote: > 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/5a5cd4de-df65-4713-97e5-317910dddf79n%40googlegroups.com.
[sqlalchemy] Re: Connection error
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.