Skip to main content

pc.get_connection

pc.get_connection(connection_name=None, connection_id=None)

Get and return the specified connection. Can get a connection either via name
or id but not both. If both connection_id and connection_name are specified, an
error will be thrown.

Parameters:

   connection_name: str, default None
Name of connection to return.

   connection_id: str, default None
ID of connection to return.

Returns:

   Connection

Examples:

Get a connection by name.

    connection = pc.get_connection('S3 Connection')

Get a connection by ID.

    pc.list_connections()
# > [Connection,
# name: Postgres Connection,
# id: 0,
# connection_type: ConnectionType.POSTGRESQL,
# properties: None,
# Connection,
# name: S3 Connection,
# id: 1,
# connection_type: ConnectionType.S3,
# properties: None]

connection = pc.get_connection(connection_id=1)