- 최신
- 최다 투표
- 가장 많은 댓글
Hiya ,
it's likely that there's a problem with the way that psycopg2 is handling IAM authentication.
One possible solution is to use the connection_factory parameter to the psycopg2.connect() function. This parameter allows you to specify a custom connection factory that will be used to create the connection. You can use this to create a connection factory that uses IAM authentication.
Here's an example of how to do this:
Python import psycopg2
def my_connection_factory(dbname, user, password, host, port): connection = psycopg2.connect( dbname=dbname, user=user, password=password, host=host, port=port, connection_factory=psycopg2.extras.LogicalReplicationConnection, ) return connection
conn = psycopg2.connect( dbname="mydb", user="replicate", password="mypassword", host="myhost", port="5432", connection_factory=my_connection_factory, ) Use code with caution. Learn more This code will create a connection to the database using IAM authentication. If the password is correct, then the connection should be successful.
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전