# LlamaIndex Readers Integration: Couchbase
```bash
pip install llama-index-readers-couchbase
```
This loader loads documents from Couchbase cluster.
The user specifies a Couchbase client or credentials to initialize the reader. They can specify the SQL++ query to
fetch the relevant docs.
## Usage
Here's an example usage of the CouchbaseReader.
```python
import os
from llama_index.readers.couchbase import CouchbaseReader
connection_string = (
"couchbase://localhost" # valid Couchbase connection string
)
db_username = "<valid_database_user_with_read_access_to_bucket_with_data>"
db_password = "<password_for_database_user>"
# query is a valid SQL++ query that is passed to client.query()
query = """
SELECT h.* FROM `travel-sample`.inventory.hotel h
WHERE h.country = 'United States'
LIMIT 5
"""
reader = CouchbaseLoader(
connection_string=connection_string,
db_username=db_username,
db_password=db_password,
)
# It is also possible to pass an initialized Couchbase client to the document loader
# from couchbase.auth import PasswordAuthenticator # noqa: E402
# from couchbase.cluster import Cluster # noqa: E402
# from couchbase.options import ClusterOptions # noqa: E402
# auth = PasswordAuthenticator(
# db_username,
# db_password,
# )
# couchbase_client = Cluster(connection_string, ClusterOptions(auth))
# reader = CouchbaseLoader(client=couchbase_client)
# fields to be written to the document
text_fields = ["name", "title", "address", "reviews"]
# metadata fields to be written to the document's metadata
metadata_fields = (["country", "city"],)
documents = reader.load_data(
query=query, text_fields=text_fields, metadata_fields=metadata_fields
)
```
This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/). See [here](https://github.com/run-llama/llama-hub/tree/main) for examples.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-couchbase",
"maintainer": "nithishr",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "Capella, Couchbase, NoSQL",
"author": null,
"author_email": "Your Name <you@example.com>",
"download_url": "https://files.pythonhosted.org/packages/ce/28/2b7307704df1a0da6671844d1feb2d0a0321ccb0bf87c5620400852b3c2f/llama_index_readers_couchbase-0.4.0.tar.gz",
"platform": null,
"description": "# LlamaIndex Readers Integration: Couchbase\n\n```bash\npip install llama-index-readers-couchbase\n```\n\nThis loader loads documents from Couchbase cluster.\nThe user specifies a Couchbase client or credentials to initialize the reader. They can specify the SQL++ query to\nfetch the relevant docs.\n\n## Usage\n\nHere's an example usage of the CouchbaseReader.\n\n```python\nimport os\n\nfrom llama_index.readers.couchbase import CouchbaseReader\n\nconnection_string = (\n \"couchbase://localhost\" # valid Couchbase connection string\n)\ndb_username = \"<valid_database_user_with_read_access_to_bucket_with_data>\"\ndb_password = \"<password_for_database_user>\"\n\n# query is a valid SQL++ query that is passed to client.query()\nquery = \"\"\"\n SELECT h.* FROM `travel-sample`.inventory.hotel h\n WHERE h.country = 'United States'\n LIMIT 5\n \"\"\"\n\nreader = CouchbaseLoader(\n connection_string=connection_string,\n db_username=db_username,\n db_password=db_password,\n)\n\n# It is also possible to pass an initialized Couchbase client to the document loader\n# from couchbase.auth import PasswordAuthenticator # noqa: E402\n# from couchbase.cluster import Cluster # noqa: E402\n# from couchbase.options import ClusterOptions # noqa: E402\n\n# auth = PasswordAuthenticator(\n# db_username,\n# db_password,\n# )\n\n# couchbase_client = Cluster(connection_string, ClusterOptions(auth))\n# reader = CouchbaseLoader(client=couchbase_client)\n\n# fields to be written to the document\ntext_fields = [\"name\", \"title\", \"address\", \"reviews\"]\n\n# metadata fields to be written to the document's metadata\nmetadata_fields = ([\"country\", \"city\"],)\n\ndocuments = reader.load_data(\n query=query, text_fields=text_fields, metadata_fields=metadata_fields\n)\n```\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/). See [here](https://github.com/run-llama/llama-hub/tree/main) for examples.\n",
"bugtrack_url": null,
"license": null,
"summary": "llama-index readers couchbase integration",
"version": "0.4.0",
"project_urls": null,
"split_keywords": [
"capella",
" couchbase",
" nosql"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1dda3625674fcf0fbe9106482980f01042fa91f74803756821fa22d3f9e0349d",
"md5": "f61807a1792f2de40bb6d01f8c3c2b5f",
"sha256": "f1f2b097e1271c65c6d85d2527aab91eac2dbf1216a606fc732aa371a46ad3c2"
},
"downloads": -1,
"filename": "llama_index_readers_couchbase-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f61807a1792f2de40bb6d01f8c3c2b5f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4353,
"upload_time": "2025-07-30T20:52:24",
"upload_time_iso_8601": "2025-07-30T20:52:24.848429Z",
"url": "https://files.pythonhosted.org/packages/1d/da/3625674fcf0fbe9106482980f01042fa91f74803756821fa22d3f9e0349d/llama_index_readers_couchbase-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ce282b7307704df1a0da6671844d1feb2d0a0321ccb0bf87c5620400852b3c2f",
"md5": "2b8838be6ab1e6324178cad8302db601",
"sha256": "bea68e9f88c85d1d8d26251e139e01f5ad185565ebd257dddbff74b8c0c282e5"
},
"downloads": -1,
"filename": "llama_index_readers_couchbase-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "2b8838be6ab1e6324178cad8302db601",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4630,
"upload_time": "2025-07-30T20:52:25",
"upload_time_iso_8601": "2025-07-30T20:52:25.890660Z",
"url": "https://files.pythonhosted.org/packages/ce/28/2b7307704df1a0da6671844d1feb2d0a0321ccb0bf87c5620400852b3c2f/llama_index_readers_couchbase-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 20:52:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-couchbase"
}