Skip to content

feat(config): node_table and rel_table builder methods - #5

Merged
prrao87 merged 1 commit into
mainfrom
feat/node-rel-tables
Oct 24, 2026
Merged

prrao87 merged 1 commit into
mainfrom
feat/node-rel-tables

Conversation

@prrao87

@prrao87 prrao87 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Why

The config builder's names didn't match each other or what they configure: with_node_label for nodes, with_relationship for edges, and a separate with_relationship_endpoints call for the node tables at each end. Each label and each relationship type maps to one dataset, the same model as Kuzu's and Ladybug's node and rel tables, so the builder now uses their names. A relationship table also always names its two endpoint tables. Label inference and relationship-type alternation need those, and leaving them out let a mislabeled query join edge ids against the wrong node table without an error.

What changed

config = (
    GraphConfig.builder()
    .node_table("Person", primary_key="id")
    .node_table("Company", primary_key="id")
    .rel_table("WORKS_AT", from_table="Person", to_table="Company", src="src", dst="dst")
    .build()
)
  • node_table(label, primary_key) replaces with_node_label(label, id_field).
  • rel_table(rel_type, from_table, to_table, src, dst) replaces with_relationship(rel_type, source_field, target_field, source_label=None, target_label=None). The endpoint tables are required, and build() fails if either one isn't a defined node table.
  • The Rust builder has the same two methods.
  • Deprecation: with_node_label, with_relationship and with_relationship_endpoints keep working, unchanged, as deprecated aliases. In Python they raise a DeprecationWarning that names the replacement; in Rust they are #[deprecated]. They're meant to be removed in a later release, after 0.2.0 ships with both.
  • Migration: tests, examples, benchmarks, the wheel check, docstrings and both READMEs use the new methods. The Python README explains node and relationship tables and notes the deprecation. Only two tests still call the old methods, deliberately: they check what happens without endpoint labels, which only the deprecated method can still configure.
  • Error messages that told users to call with_relationship_endpoints now point at rel_table's from_table and to_table.

Rewriting about 300 call sites was mostly mechanical. A script added the endpoints, using the chain's single node table where it had one. For the 40 calls in configs with several node tables, the endpoints were chosen from what each relationship means (for example, WORKS_FOR from Person to Company).

Validation

  • Rust: cargo test --workspace passes 584 tests (three new ones: endpoints recorded, undefined endpoint table rejected, deprecated methods still work). cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check are clean, so no remaining call reaches a deprecated method without an explicit allow.
  • Python: 332 tests pass, including three new builder tests: the keyword arguments, endpoint validation, and the deprecated names warning while still working. The suite turns DeprecationWarning into an error, so no test calls the old names unknowingly. ruff and pyright are clean.
  • All three examples run.
  • Pending in CI: this PR edits ci/check_wheel.py, so the wheel build and wheel tests run here too.
  • Rebased onto main after docs: state goals and scope, show the ldbc benchmark, move builds to uv #4 with no conflicts; the checks above were rerun on the rebased branch.
  • Docs move ahead of PyPI: the examples and README now use the new methods, but 0.1.0 on PyPI doesn't have them. uv run --with lance-csr python examples/basic_cypher.py fails with AttributeError: ... no attribute 'node_table' until the next release ships.

🤖 Generated with Claude Code

GraphConfigBuilder gains node_table(label, primary_key) and
rel_table(type, from_table, to_table, src, dst), named after Kuzu's node
and rel tables. A relationship table always names the node tables at
both ends, so labels can be inferred and alternation planned without a
separate endpoints call. with_node_label, with_relationship and
with_relationship_endpoints remain as deprecated aliases (a
DeprecationWarning in Python). Tests, examples, benchmarks and docs use
the new methods.
@prrao87
prrao87 force-pushed the feat/node-rel-tables branch from 8ce4e3d to a030166 Compare October 24, 2026 15:47
@prrao87
prrao87 marked this pull request as ready for review October 24, 2026 16:13
@prrao87
prrao87 merged commit 0b1f99d into main Oct 24, 2026
7 of 8 checks passed
@prrao87
prrao87 deleted the feat/node-rel-tables branch October 24, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant