# Graph Database Cypher Loader
```bash
pip install llama-index-readers-graphdb-cypher
```
This loader populates documents from results of Cypher queries from a Graph database endpoint.
The user specifies a GraphDB endpoint URL with optional credentials to initialize the reader.
By declaring the Cypher query and optional parameters the loader can fetch the nested result docs.
The results will be turned into a yaml representation to be turned into a string for the document.
The approach should work for Neo4j, AWS Neptune and Memgraph.
## Usage
Here's an example usage of the `GraphDBCypherReader`.
You can test out queries directly with the Neo4j labs demo server: demo.neo4jlabs.com or with a free instance https://neo4j.com/aura
```python
import os
from llama_index.readers.graphdb_cypher import GraphDBCypherReader
uri = "neo4j+s://demo.neo4jlabs.com"
username = "stackoverflow"
password = "stackoverflow"
database = "stackoverflow"
query = """
MATCH (q:Question)-[:TAGGED]->(:Tag {name:$tag})
RETURN q.title as title
ORDER BY q.createdAt DESC LIMIT 10
"""
reader = GraphDBCypherReader(uri, username, password, database)
documents = reader.load_data(query, parameters={"tag": "lua"})
```
This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index)
and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
It uses the [Neo4j Graph Database](https://neo4j.com/developer) for the Cypher queries.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-graphdb-cypher",
"maintainer": "jexp",
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": "cypher, graph, neo4j",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/40/9c/8f7cdb5bc5d650099269ecb467b17ad9722d5a933a5afa9dfe946672ac1a/llama_index_readers_graphdb_cypher-0.2.0.tar.gz",
"platform": null,
"description": "# Graph Database Cypher Loader\n\n```bash\npip install llama-index-readers-graphdb-cypher\n```\n\nThis loader populates documents from results of Cypher queries from a Graph database endpoint.\nThe user specifies a GraphDB endpoint URL with optional credentials to initialize the reader.\nBy declaring the Cypher query and optional parameters the loader can fetch the nested result docs.\nThe results will be turned into a yaml representation to be turned into a string for the document.\n\nThe approach should work for Neo4j, AWS Neptune and Memgraph.\n\n## Usage\n\nHere's an example usage of the `GraphDBCypherReader`.\n\nYou can test out queries directly with the Neo4j labs demo server: demo.neo4jlabs.com or with a free instance https://neo4j.com/aura\n\n```python\nimport os\n\nfrom llama_index.readers.graphdb_cypher import GraphDBCypherReader\n\nuri = \"neo4j+s://demo.neo4jlabs.com\"\nusername = \"stackoverflow\"\npassword = \"stackoverflow\"\ndatabase = \"stackoverflow\"\n\nquery = \"\"\"\n MATCH (q:Question)-[:TAGGED]->(:Tag {name:$tag})\n RETURN q.title as title\n ORDER BY q.createdAt DESC LIMIT 10\n\"\"\"\nreader = GraphDBCypherReader(uri, username, password, database)\ndocuments = reader.load_data(query, parameters={\"tag\": \"lua\"})\n```\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index)\nand/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.\n\nIt uses the [Neo4j Graph Database](https://neo4j.com/developer) for the Cypher queries.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers graphdb_cypher integration",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"cypher",
" graph",
" neo4j"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2de71c6b6c4413c477c7819223cbc53eef94ab675b613a6495bf17d8ab1a09c4",
"md5": "d000c8bd57eb913ecd783f69bdec7a5f",
"sha256": "490e83d30041d3aceeb370a314c2069c60da2ae409a91034a333cc15f3d167b5"
},
"downloads": -1,
"filename": "llama_index_readers_graphdb_cypher-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d000c8bd57eb913ecd783f69bdec7a5f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 3139,
"upload_time": "2024-08-22T06:13:34",
"upload_time_iso_8601": "2024-08-22T06:13:34.681912Z",
"url": "https://files.pythonhosted.org/packages/2d/e7/1c6b6c4413c477c7819223cbc53eef94ab675b613a6495bf17d8ab1a09c4/llama_index_readers_graphdb_cypher-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "409c8f7cdb5bc5d650099269ecb467b17ad9722d5a933a5afa9dfe946672ac1a",
"md5": "184839e7d7f7714e5d868ce75a74e544",
"sha256": "e4aafcf7d695532cc97f3933f181991458cc39dd3fb8a78295cfd7fb2125439c"
},
"downloads": -1,
"filename": "llama_index_readers_graphdb_cypher-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "184839e7d7f7714e5d868ce75a74e544",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 2835,
"upload_time": "2024-08-22T06:13:35",
"upload_time_iso_8601": "2024-08-22T06:13:35.825232Z",
"url": "https://files.pythonhosted.org/packages/40/9c/8f7cdb5bc5d650099269ecb467b17ad9722d5a933a5afa9dfe946672ac1a/llama_index_readers_graphdb_cypher-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 06:13:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-graphdb-cypher"
}