Skip to content

InvalidDatabaseType: Exception thrown on connect() to secret_id / arn & friendly name #630

Closed
@JoshCrosby

Description

@JoshCrosby

Describe the bug
A clear and concise description of what the bug is.
wr.postgrest.connect() fails to connect to the database, the error indicates it must be a PostgreSQL connection.

To Reproduce
Steps to reproduce the behavior. Also, add details about Python and Wrangler's version and how the library was installed.

con = wr.postgresql.connect(secret_id="arn:aws:secretsmanager:us-east-1:****************:secret:db/rds/postgres/awswrangler-OFWDkE")
with con.cursor() as cursor:
    cursor.execute("SELECT 1")
    print(cursor.fetchall())
con.close()

Throws

---------------------------------------------------------------------------
InvalidDatabaseType                       Traceback (most recent call last)
<ipython-input-8-75cb71999960> in <module>
      1 import awswrangler as wr
----> 2 con = wr.postgresql.connect(secret_id="arn:aws:secretsmanager:us-east-1:**************:secret:db/rds/postgres/awswrangler-OFWDkE")
      3 with con.cursor() as cursor:
      4     cursor.execute("SELECT 1")
      5     print(cursor.fetchall())

~/.pyenv/versions/anaconda3-2020.11/lib/python3.8/site-packages/awswrangler/postgresql.py in connect(connection, secret_id, catalog_id, dbname, boto3_session, ssl_context, timeout, tcp_keepalive)
    133     )
    134     if attrs.kind != "postgresql":
--> 135         raise exceptions.InvalidDatabaseType(
    136             f"Invalid connection type ({attrs.kind}. It must be a postgresql connection.)"
    137         )

InvalidDatabaseType: Invalid connection type (postgres. It must be a postgresql connection.)

P.S. Don't attach files. Please, prefer add code snippets directly in the message body.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions