-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BaseGraphStoreDriver and FalkorDBGraphStoreDriver with tests and …
…documentation, along with changed to CHANGELOG
- Loading branch information
Showing
9 changed files
with
202 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Overview | ||
|
||
Griptape provides a way to build drivers for graph databases where graph data can be stored and queried. Every graph store driver implements the following methods: | ||
|
||
- `upsert_node()` for updating or inserting a new node into graph databases. | ||
- `upsert_node_artifacts()` for updating or inserting multiple nodes into graph databases. | ||
- `upsert_edge()` for updating and inserting new edges between nodes in graph databases. | ||
- `query_nodes()` for querying nodes in graph databases. | ||
- `query_edges()` for querying edges in graph databases. | ||
|
||
Each graph driver extends the `BaseGraphStoreDriver`, which provides additional utility methods to manage graph structures. | ||
|
||
!!! info | ||
When working with graph database indexes with Griptape drivers, ensure that your schema supports the required node and edge properties. Check the documentation for your graph database on how to create and manage graph schemas. | ||
|
||
## FalkorDB | ||
|
||
!!! info | ||
This driver requires the `drivers-graph-falkordb` [extra](../index.md#extras). | ||
|
||
The [FalkorDBGraphStoreDriver](../../reference/griptape/drivers/graph/falkordb_graph_store_driver.md) supports the [FalkorDB graph database](https://www.falkordb.com/). | ||
|
||
Here is an example of how the driver can be used to load and query information in a FalkorDB cluster: | ||
|
||
```python | ||
import os | ||
from griptape.drivers.graph import FalkorDBGraphStoreDriver | ||
|
||
# Initialize the FalkorDB driver | ||
falkordb_driver = FalkorDBGraphStoreDriver( | ||
url=os.environ["FALKORDB_URL"], | ||
api_key=os.environ["FALKORDB_API_KEY"] | ||
) | ||
|
||
# Example node data | ||
node_data = { | ||
"id": "1", | ||
"label": "Person", | ||
"properties": { | ||
"name": "Alice", | ||
"age": 30 | ||
} | ||
} | ||
|
||
# Upsert a node | ||
falkordb_driver.upsert_node(node_data) | ||
|
||
# Query nodes | ||
results = falkordb_driver.query_nodes("MATCH (n:Person) RETURN n") | ||
|
||
for result in results: | ||
print(result) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.