Tool

Connect to Oracle DB and Load Data with LlamaIndex

Load and chunk documents from Oracle Database or files with OracleReader and OracleTextSplitter.

Works with oracle

73
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate Oracle Database data into your LlamaIndex applications. This asset allows you to load documents directly from Oracle tables and split them into manageable chunks for further processing.

Outcomes

What it gets done

01

Load documents from Oracle Database tables.

02

Split documents into customizable chunks.

03

Establish and manage Oracle database connections.

04

Prepare Oracle data for use in LLM applications.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-oracleai | bash

Overview

LlamaIndex Readers Integration: Oracleai

Two LlamaIndex classes for Oracle data: OracleReader loads from files, directories, or database tables, and OracleTextSplitter chunks the text. Use for loading and chunking Oracle-sourced documents with fine control over both steps, given an active Oracle connection.

What it does

The Oracleai Readers Integration provides two distinct classes for working with Oracle-sourced data in LlamaIndex. OracleReader loads documents from a file, a directory, or an Oracle Database table. OracleTextSplitter splits a loaded document into chunks, with extensive customization of how that splitting happens.

Both classes are initialized with an existing Oracle database connection (via oracledb.connect) and their own params dictionary. The source's own worked example configures OracleReader to load from a table (specifying an owner, table name, and column name) and OracleTextSplitter to split by words with a maximum chunk size, then iterates the loaded documents, printing each one's metadata and the number of chunks its text was split into.

When to use - and when NOT to

Use OracleReader when you need to load documents directly from an Oracle Database table, a single file, or a directory of files, using the same reader class for all three sources. Use OracleTextSplitter alongside it when you need fine-grained control over how those documents get chunked, rather than relying on a generic length-based splitter. Do not use it without an active oracledb connection - both classes are constructed with one, and the connection should be explicitly closed after use.

Capabilities

OracleReader loads documents from a file, directory, or Oracle Database table via an Oracle connection. OracleTextSplitter splits document text into customizable chunks (for example by word count with a maximum size).

How to install

pip install llama-index-readers-oracleai

Requires an active Oracle Database connection via oracledb.connect.

Who it's for

Developers who need to load and chunk documents from Oracle Database tables or files into LlamaIndex, with fine control over both loading source and text splitting.

Source README

LlamaIndex Readers Integration: Oracleai

There are two classes here:

  • OracleReader: This API is to load document(s) from a file or a directory or a Oracle Database table.
  • OracleTextSplitter: This API is to split a document into chunks with a lots of customizations.

pip install llama-index-readers-oracleai

A sample example

### get the Oracle connection
conn = oracledb.connect(
    user="",
    password="",
    dsn="",
)
print("Oracle connection is established...")

### params
loader_params = {"owner": "ut", "tablename": "demo_tab", "colname": "data"}
splitter_params = {"by": "words", "max": "100"}

### instances
loader = OracleReader(conn=conn, params=loader_params)
splitter = OracleTextSplitter(conn=conn, params=splitter_params)

print("Processing the documents...")
docs = loader.load()
for id, doc in enumerate(docs, start=1):
    print(f"Document#{id}, Metadata: {doc.metadata}")
    chunks = splitter.split_text(doc.text)
    print(f"Document#{id}, Num of Chunk: {len(chunks)}\n")

conn.close()
print("Connection is closed.")

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.