Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is
one of dependencies and versions, and indirectly permissions.
With virtualenv, it’s
possible to install this library without needing system install
permissions, and without clashing with the installed system
dependencies.
Use ChatMessageHistory to store messages and provide conversation
history to LLMs.
from langchain_google_el_carro import ElCarroEngine
from langchain_google_el_carro.chat_message_history import \
ElCarroChatMessageHistory
elcarro_engine = ElCarroEngine.from_instance(
"Your El Carro endpoint hostname", # e.g. 127.0.0.1
"Your El Carro endpoint port", # e.g. 3307
"Your PDB name", # e.g. PDB1
"Your DB user",
"Your DB password",
)
history = ElCarroChatMessageHistory(
elcarro_engine=elcarro_engine,
table_name="my-message-store",
session_id="my-session_id"
)
Thick mode connectivity requires you to install the Oracle Client libraries and pass thick_mode=True to ElCarroEngine. Follow these sections of the oracledb installation guide:
Contributions to this library are always welcome and highly encouraged.
See CONTRIBUTING for more information how to get started.
Please note that this project is released with a Contributor Code of Conduct. By participating in
this project you agree to abide by its terms. See Code of Conduct for more
information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["El Carro for Oracle Databases for LangChain\n===========================================\n\n[](https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels) [](https://pypi.org/project/langchain-google-el-carro/) [](https://pypi.org/project/langchain-google-el-carro/)\n\n- [Client Library Documentation](https://cloud.google.com/python/docs/reference/langchain-google-el-carro/latest)\n\n- [Product Documentation](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator)\n\nKnown Limitations\n-----------------\n\n- The library supports El Carro Operator for Oracle 18c and higher versions.\n\n- By default the library uses [thin mode.](https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_b.html) for Oracle connectivity,\n to use thick mode please follow the corresponding [section.](#oracle-thick-mode-connectivity).\n\n- To use VARCHAR2 datatype of size more than 4000 please change the parameter [MAX_STRING_SIZE.](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/MAX_STRING_SIZE.html#GUID-D424D23B-0933-425F-BC69-9C0E6724693C)\n in the Oracle instance.\n\nQuick Start\n-----------\n\n### Create an El Carro Operator Oracle Instance and a Database (PDB)\n\nIn order to use this library, you first need to have an El Carro Operator\nsoftware running with an Instance (CDB) and a Database (PDB).\n\nPlease follow the steps for El Carro Oracle Operator to provision a new database\nand create a PDB:\n\n- [El Carro Oracle 18c XE quickstart](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator/blob/main/docs/content/quickstart-18c-xe.md)\n\n- [El Carro Oracle 19c EE quickstart](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator/blob/main/docs/content/quickstart-19c-ee.md)\n\n### Installation\n\nInstall this library in a [virtualenv](https://virtualenv.pypa.io/en/latest/) using pip. [virtualenv](https://virtualenv.pypa.io/en/latest/) is a tool to create isolated Python environments. The basic problem it addresses is\none of dependencies and versions, and indirectly permissions.\n\nWith [virtualenv](https://virtualenv.pypa.io/en/latest/), it's\npossible to install this library without needing system install\npermissions, and without clashing with the installed system\ndependencies.\n\n#### Supported Python Versions\n\nPython \\\u003e= 3.8\n\n#### Mac/Linux\n\n pip install virtualenv\n virtualenv \u003cyour-env\u003e\n source \u003cyour-env\u003e/bin/activate\n \u003cyour-env\u003e/bin/pip install langchain-google-el-carro\n\n#### Windows\n\n pip install virtualenv\n virtualenv \u003cyour-env\u003e\n \u003cyour-env\u003e\\Scripts\\activate\n \u003cyour-env\u003e\\Scripts\\pip.exe install langchain-google-el-carro\n\n### Document Loader Usage\n\nUse a document loader to load data as LangChain `Document`s. \n\n from langchain_google_el_carro import ElCarroEngine\n from langchain_google_el_carro.loader import \\\n ElCarroLoader, ElCarroDocumentSaver\n\n elcarro_engine = ElCarroEngine.from_instance(\n \"Your El Carro endpoint hostname\", # e.g. 127.0.0.1\n \"Your El Carro endpoint port\", # e.g. 3307\n \"Your PDB name\", # e.g. PDB1\n \"Your DB user\",\n \"Your DB password\",\n )\n loader = ElCarroLoader(\n elcarro_engine,\n table_name=\"my-table-name\"\n )\n docs = loader.lazy_load()\n\nSee the full [Document Loader](https://github.com/googleapis/langchain-google-el-carro-python/blob/main/docs/document_loader.ipynb) tutorial.\n\nChat Message History Usage\n--------------------------\n\nUse `ChatMessageHistory` to store messages and provide conversation\nhistory to LLMs. \n\n from langchain_google_el_carro import ElCarroEngine\n from langchain_google_el_carro.chat_message_history import \\\n ElCarroChatMessageHistory\n\n elcarro_engine = ElCarroEngine.from_instance(\n \"Your El Carro endpoint hostname\", # e.g. 127.0.0.1\n \"Your El Carro endpoint port\", # e.g. 3307\n \"Your PDB name\", # e.g. PDB1\n \"Your DB user\",\n \"Your DB password\",\n )\n history = ElCarroChatMessageHistory(\n elcarro_engine=elcarro_engine,\n table_name=\"my-message-store\",\n session_id=\"my-session_id\"\n )\n\nSee the full [Chat Message History](https://github.com/googleapis/langchain-google-el-carro-python/blob/main/docs/chat_message_history.ipynb) tutorial.\n\nOracle Thick Mode Connectivity\n------------------------------\n\nThick mode connectivity requires you to install the Oracle Client libraries and pass `thick_mode=True` to `ElCarroEngine`. Follow these sections of the oracledb installation guide:\n\n- [Oracle Instant Client Zip Files](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html#oracle-instant-client-zip-files)\n\n- [Oracle Instant Client RPMs](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html#oracle-instant-client-rpms)\n\nExample for Linux x64, glibc 2.14+: \n\n wget https://download.oracle.com/otn_software/linux/instantclient/2113000/instantclient-basic-linux.x64-21.13.0.0.0dbru.zip -O /tmp/drv.zip\n rm -fr /tmp/instantclient_21_13/; unzip /tmp/drv.zip -d /tmp\n export LD_LIBRARY_PATH=/tmp/instantclient_21_13/:$LD_LIBRARY_PATH\n\n### Contributions\n\nContributions to this library are always welcome and highly encouraged.\n\nSee [CONTRIBUTING](https://github.com/googleapis/langchain-google-el-carro-python/blob/main/CONTRIBUTING.md) for more information how to get started.\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in\nthis project you agree to abide by its terms. See [Code of Conduct](https://github.com/googleapis/langchain-google-el-carro-python/blob/main/CODE_OF_CONDUCT.md) for more\ninformation.\n\nLicense\n-------\n\nApache 2.0 - See\n[LICENSE](https://github.com/googleapis/langchain-google-el-carro-python/tree/main/LICENSE)\nfor more information.\n\nDisclaimer\n----------\n\nThis is not an officially supported Google product."]]