How do I connect to Postgresql using SSL from SqlAchemy+pg8000?

前端 未结 1 1745
萌比男神i
萌比男神i 2020-12-21 00:52

Connecting to postgres via pg8000 from SqlAlchemy worked fine until I enabled SSL on postgres.

db = create_engine(\'postgresql+pg8000://user:pass@hostname/db         


        
1条回答
  •  隐瞒了意图╮
    2020-12-21 01:04

    probably you need to add connect_args dict:

    db = create_engine('postgresql+pg8000://user:pass@hostname/dbname', connect_args={'sslmode':'require'}, echo=True).connect()
    

    0 讨论(0)
提交回复
热议问题