# Graph Database Cypher Loader
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
from llama_index import download_loader
import os
GraphDBCypherReader = download_loader("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.
See [here](https://github.com/emptycrown/llama-hub/tree/main) for examples.
It uses the [Neo4j Graph Database](https://neo4j.com/developer) for the Cypher queries.
Raw data
{
"_id": null,
"home_page": "",
"name": "llama-index-readers-graphdb-cypher",
"maintainer": "jexp",
"docs_url": null,
"requires_python": ">=3.8.1,<3.12",
"maintainer_email": "",
"keywords": "cypher,graph,neo4j",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/b8/03/e65241138138cd71dc6413752dc593d636bf2c9a2add20cccd89b15288b0/llama_index_readers_graphdb_cypher-0.1.2.tar.gz",
"platform": null,
"description": "# Graph Database Cypher Loader\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\nfrom llama_index import download_loader\nimport os\n\nGraphDBCypherReader = download_loader(\"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.\nSee [here](https://github.com/emptycrown/llama-hub/tree/main) for examples.\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.1.2",
"project_urls": null,
"split_keywords": [
"cypher",
"graph",
"neo4j"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c512ed1fde6fdeb667d989cb002780fb9e5c7c4aa761b8663f13a01283e6c940",
"md5": "b628898ffc6581399fdb4ed134f52d99",
"sha256": "48d67153509b513e26960d56480eac385e792eacace62b8ba1e703a02452e5e2"
},
"downloads": -1,
"filename": "llama_index_readers_graphdb_cypher-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b628898ffc6581399fdb4ed134f52d99",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<3.12",
"size": 3381,
"upload_time": "2024-02-13T20:52:34",
"upload_time_iso_8601": "2024-02-13T20:52:34.142642Z",
"url": "https://files.pythonhosted.org/packages/c5/12/ed1fde6fdeb667d989cb002780fb9e5c7c4aa761b8663f13a01283e6c940/llama_index_readers_graphdb_cypher-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b803e65241138138cd71dc6413752dc593d636bf2c9a2add20cccd89b15288b0",
"md5": "366ed0f23526d6edcbfd68c923c1859e",
"sha256": "92a7ce7a6f36589a9a209e833334db882d42b927823554fc7fbad60acb1f87e2"
},
"downloads": -1,
"filename": "llama_index_readers_graphdb_cypher-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "366ed0f23526d6edcbfd68c923c1859e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<3.12",
"size": 2881,
"upload_time": "2024-02-13T20:52:35",
"upload_time_iso_8601": "2024-02-13T20:52:35.795998Z",
"url": "https://files.pythonhosted.org/packages/b8/03/e65241138138cd71dc6413752dc593d636bf2c9a2add20cccd89b15288b0/llama_index_readers_graphdb_cypher-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-13 20:52:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-graphdb-cypher"
}