It seems like an oversight not to have ?sslmode=require
appended to the connection string?
Is it?
And if it is, could you guys add it?
It seems like an oversight not to have ?sslmode=require
appended to the connection string?
Is it?
And if it is, could you guys add it?
I’m running a django backend with sqlAlchemy and pg8000 and every time I try to interact with my neon PostgreSQL database i get this error File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 615, in connect return self.loaded_dbapi.connect(*cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: connect() got an unexpected keyword argument 'ssl'
How can I fix it please, I think it’s because sslMode is set to require.
Hey,
I just tested pg8000 with SSL enabled with this .py test script and it worked. Hope there’s something here that helps.
import pg8000.native
def test_pg8000_connection():
db_config = {
'user': 'daniel',
'password': 'abcd12345',
'host': 'ep-cool-resonance-123456.us-east-2.aws.neon.tech',
'database': 'neondb',
'port': '5432', # Default PostgreSQL port
'ssl_context': True, # Enable SSL
}
try:
conn = pg8000.native.Connection(**db_config)
print("Successfully connected to the database")
cursor = conn.run("SELECT version();")
for row in cursor:
print("Database version:", row[0])
conn.close()
except Exception as e:
print("Error while connecting to PostgreSQL:", e)
test_pg8000_connection()