Load documents from CouchDB into LlamaIndex
LlamaIndex reader that loads documents from a CouchDB 3.x database by query.
Why it matters
Extract and load documents from CouchDB databases into LlamaIndex for indexing and retrieval-augmented generation workflows. The loader connects to CouchDB 3.x instances and fetches documents using CouchDB's native query syntax.
Outcomes
What it gets done
Connect to CouchDB 3.x instances using host and port configuration
Query specific databases using CouchDB find() syntax
Fetch and transform CouchDB documents into LlamaIndex format
Load retrieved documents into LlamaIndex for RAG applications
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-couchdb | bash Overview
CouchDB Loader
The CouchDB Loader pulls documents from a CouchDB 3.x database into LlamaIndex, using the CouchDB3 Python wrapper and a Mango-find query to select which documents to load. Use it when you need documents from an existing CouchDB 3.x database loaded into LlamaIndex by query. It only supports CouchDB 3.x via the CouchDB3 wrapper.
What it does
The CouchDB Loader loads documents from a CouchDB instance into LlamaIndex documents. It currently supports CouchDB 3.x, using the CouchDB3 Python wrapper. You initialize SimpleCouchDBReader with a host and port, then load data by specifying a database name and a query, passed into CouchDB's own db.find().
When to use - and when NOT to
Use it when you need to pull documents matching a CouchDB Mango query out of an existing CouchDB 3.x database into a LlamaIndex pipeline. It is built specifically against CouchDB 3.x via the CouchDB3 wrapper, so it is not a fit for older CouchDB major versions or other document databases.
Inputs and outputs
Install with:
pip install llama-index-readers-couchdb
Connect and load documents by database and query:
import os
from llama_index.readers.couchdb import SimpleCouchDBReader
host = "<host>"
port = "<port>"
db_name = "<db_name>"
### query is passed into db.find()
query_str = "{ couchdb_find_sytax_json }"
reader = SimpleCouchDBReader(host, port)
documents = reader.load_data(db_name, query=query_str)
SimpleCouchDBReader takes a host and port to connect; load_data takes the target db_name and a query string in CouchDB's Mango-find JSON syntax.
Who it's for
Developers building LlamaIndex pipelines that need documents pulled from an existing CouchDB 3.x database by a Mango-style query.
Source README
CouchDB Loader
pip install llama-index-readers-couchdb
This loader loads documents from CouchDB. The loader currently supports CouchDB 3.x
using the CouchDB3 python wrapper from https://github.com/n-vlahovic/couchdb3
The user specifies a CouchDB instance to initialize the reader. They then specify
the database name and query params to fetch the relevant docs.
Usage
Here's an example usage of the SimpleCouchDBReader.
import os
from llama_index.readers.couchdb import SimpleCouchDBReader
host = "<host>"
port = "<port>"
db_name = "<db_name>"
### query is passed into db.find()
query_str = "{ couchdb_find_sytax_json }"
reader = SimpleCouchDBReader(host, port)
documents = reader.load_data(db_name, query=query_str)
This loader is designed to be used as a way to load data into LlamaIndex.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.