Oracle Autonomous Database | 🦜️🔗 LangChain
Skip to main content
Open In ColabOpen on GitHub

Oracle Autonomous Database

Oracle autonomous database is a cloud database that uses machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by DBAs.

This notebook covers how to load documents from oracle autonomous database, the loader supports connection with connection string or tns configuration.

Prerequisites

  1. Database runs in a 'Thin' mode: https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_b.html
  2. pip install oracledb: https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html

Instructions

pip install oracledb
from langchain_community.document_loaders import OracleAutonomousDatabaseLoader
from settings import s

With mutual TLS authentication (mTLS), wallet_location and wallet_password are required to create the connection, user can create connection by providing either connection string or tns configuration details.

SQL_QUERY = "select prod_id, time_id from sh.costs fetch first 5 rows only"

doc_loader_1 = OracleAutonomousDatabaseLoader(
query=SQL_QUERY,
user=s.USERNAME,
password=s.PASSWORD,
schema=s.SCHEMA,
config_dir=s.CONFIG_DIR,
wallet_location=s.WALLET_LOCATION,
wallet_password=s.PASSWORD,
tns_name=s.TNS_NAME,
)
doc_1 = doc_loader_1.load()

doc_loader_2 = OracleAutonomousDatabaseLoader(
query=SQL_QUERY,
user=s.USERNAME,
password=s.PASSWORD,
schema=s.SCHEMA,
connection_string=s.CONNECTION_STRING,
wallet_location=s.WALLET_LOCATION,
wallet_password=s.PASSWORD,
)
doc_2 = doc_loader_2.load()

With TLS authentication, wallet_location and wallet_password are not required. Bind variable option is provided by argument "parameters".

SQL_QUERY = "select channel_id, channel_desc from sh.channels where channel_desc = :1 fetch first 5 rows only"

doc_loader_3 = OracleAutonomousDatabaseLoader(
query=SQL_QUERY,
user=s.USERNAME,
password=s.PASSWORD,
schema=s.SCHEMA,
config_dir=s.CONFIG_DIR,
tns_name=s.TNS_NAME,
parameters=["Direct Sales"],
)
doc_3 = doc_loader_3.load()

doc_loader_4 = OracleAutonomousDatabaseLoader(
query=SQL_QUERY,
user=s.USERNAME,
password=s.PASSWORD,
schema=s.SCHEMA,
connection_string=s.CONNECTION_STRING,
parameters=["Direct Sales"],
)
doc_4 = doc_loader_4.load()

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.