-
Notifications
You must be signed in to change notification settings - Fork 451
Add Ladybug (successor to Kuzu) as a target #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
prrao87
wants to merge
3
commits into
cocoindex-io:main
Choose a base branch
from
prrao87:feat/ladybug-target
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,51 @@ | ||
| --- | ||
| title: Ladybug | ||
| description: CocoIndex Ladybug Target | ||
| toc_max_heading_level: 4 | ||
| --- | ||
| import { ExampleButton } from '../../src/components/GitHubButton'; | ||
|
|
||
| # Ladybug | ||
|
|
||
| Exports data to a [Ladybug](https://github.com/LadybugDB/ladybug) graph database. Ladybug is a maintained fork of Kuzu that carries forth the original vision of Kuzu, with added functionality for the lakehouse ecosystem. Just like Kuzu, Ladybug follows the structurd property graph model and functions as a fast, embedded database with a permissive (MIT) license. | ||
|
|
||
| ## Get Started | ||
|
|
||
| Read [Property Graph Targets](./index.md#property-graph-targets) for more information to get started on how it works in CocoIndex. | ||
|
|
||
| ## Spec | ||
|
|
||
| CocoIndex supports talking to Ladybug through its API server. You can run the server from [LadybugDB/api-server](https://github.com/LadybugDB/api-server). | ||
|
|
||
| The `Ladybug` target spec takes the following fields: | ||
|
|
||
| * `connection` ([auth reference](/docs/core/flow_def#auth-registry) to `LadybugConnectionSpec`): The connection to the Ladybug database. `LadybugConnectionSpec` has the following fields: | ||
| * `api_server_url` (`str`): The URL of the Ladybug API server, e.g. `http://localhost:8123`. | ||
| * `mapping` (`Nodes | Relationships`): The mapping from collected row to nodes or relationships of the graph. For either [nodes to export](./index.md#nodes-to-export) or [relationships to export](./index.md#relationships-to-export). | ||
|
|
||
| Ladybug also provides a declaration spec `LadybugDeclaration`, to configure indexing options for nodes only referenced by relationships. It has the following fields: | ||
|
|
||
| * `connection` (auth reference to `LadybugConnectionSpec`) | ||
| * Fields for [nodes to declare](./index.md#declare-extra-node-labels), including | ||
| * `nodes_label` (required) | ||
| * `primary_key_fields` (required) | ||
|
|
||
| ## Ladybug API server | ||
|
|
||
| For running the API server locally or in Docker, follow the instructions in the Ladybug documentation. | ||
|
|
||
| ## Python client | ||
|
|
||
| If you want the Ladybug Python client, install it with: | ||
|
|
||
| ```sh | ||
| pip install real_ladybug | ||
| ``` | ||
|
|
||
| ## Example | ||
|
|
||
| <ExampleButton | ||
| href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph" | ||
| text="Docs to Knowledge Graph" | ||
| margin="16px 0 24px 0" | ||
| /> | ||
This file contains hidden or 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 hidden or 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 hidden or 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,27 @@ | ||
| from cocoindex.auth_registry import AuthEntryReference, ref_auth_entry | ||
| from cocoindex.engine_object import dump_engine_object | ||
| from cocoindex.targets import Ladybug, LadybugConnection, LadybugDeclaration, Nodes | ||
|
|
||
|
|
||
| def test_ladybug_target_dump() -> None: | ||
| conn_ref: AuthEntryReference[LadybugConnection] = ref_auth_entry("ladybug") | ||
| spec = Ladybug(connection=conn_ref, mapping=Nodes(label="Document")) | ||
| dumped = dump_engine_object(spec) | ||
|
|
||
| assert dumped["connection"]["key"] == "ladybug" | ||
| assert dumped["mapping"]["kind"] == "Node" | ||
| assert dumped["mapping"]["label"] == "Document" | ||
|
|
||
|
|
||
| def test_ladybug_declaration_dump() -> None: | ||
| conn_ref: AuthEntryReference[LadybugConnection] = ref_auth_entry("ladybug") | ||
| decl = LadybugDeclaration( | ||
| connection=conn_ref, | ||
| nodes_label="Place", | ||
| primary_key_fields=["name"], | ||
| ) | ||
| dumped = dump_engine_object(decl) | ||
|
|
||
| assert dumped["kind"] == "Ladybug" | ||
| assert dumped["nodes_label"] == "Place" | ||
| assert dumped["primary_key_fields"] == ["name"] |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
structured