awswrangler.oracle.connect

awswrangler.oracle.connect(connection: str | None = None, secret_id: str | None = None, catalog_id: str | None = None, dbname: str | None = None, boto3_session: Session | None = None, call_timeout: int | None = 0) oracledb.Connection

Return a oracledb connection from a Glue Catalog Connection.

https://github.com/oracle/python-oracledb

Note

You MUST pass a connection OR secret_id. Here is an example of the secret structure in Secrets Manager: { “host”:”oracle-instance-wrangler.cr4trrvge8rz.us-east-1.rds.amazonaws.com”, “username”:”test”, “password”:”test”, “engine”:”oracle”, “port”:”1521”, “dbname”: “mydb” # Optional }

Parameters:
  • connection (str | None) – Glue Catalog Connection name.

  • secret_id (str | None) – Specifies the secret containing the connection details that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

  • catalog_id (str | None) – The ID of the Data Catalog. If none is provided, the AWS account ID is used by default.

  • dbname (str | None) – Optional database name to overwrite the stored one.

  • boto3_session (Session | None) – The default boto3 session will be used if boto3_session is None.

  • call_timeout (int | None) – This is the time in milliseconds that a single round-trip to the database may take before a timeout will occur. The default is None which means no timeout. This parameter is forwarded to oracledb. https://cx-oracle.readthedocs.io/en/latest/api_manual/connection.html#Connection.call_timeout

Return type:

Connection

Returns:

oracledb connection.

Examples

>>> import awswrangler as wr
>>> with wr.oracle.connect(connection="MY_GLUE_CONNECTION") as con:
...     with con.cursor() as cursor:
...         cursor.execute("SELECT 1 FROM DUAL")
...         print(cursor.fetchall())