Replies: 1 comment
-
|
My mistake, I found coalesce as the existing path I was requesting. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature Request: Built-in Upsert/Merge Operation in Modern Rust DSL
Summary
Request for a built-in
upsert_n(ormerge_n) function in the modern Rust DSL to simplify idempotent node creation, achieving feature parity with theUpsertNfunction available in the legacy HelixQL API.Use Case
We're building a SQL Server metadata tracking system using HelixDB. We extract metadata from 100+ SQL Servers, load it into a graph database for dependency analysis, and refresh daily with a clean snapshot.
The de-duplication challenge:
During a single load, we process thousands of objects that reference the same shared Extended Property values repeatedly.
Concrete example:
"GTM"for Extended Property"Owned_By""GTM"nodes ❌"GTM"node, referenced 1,000 times ✅Why model values as nodes instead of properties?
We need to query by value efficiently (e.g., "Find all tables owned by
"GTM". Extended Property name"Owned_By"with property value 'GTM'"). Modeling values as nodes with relationships enables:PropertyValue→ExtendedProperty→TableIf stored as properties on the node, these queries would require full table scans filtering on property values.
This pattern applies to many shared entity types:
What we need: "Get existing node if it exists, create if it doesn't" - exactly what HelixQL's
UpsertNprovides.Background: HelixQL Has This, Modern Rust DSL Doesn't
HelixQL (Legacy) appears to provide simple, elegant upsert:
Behavior:
Modern Rust DSL lacks equivalent functionality, requiring manual conditional logic to achieve the same result.
Current Workaround (Manual Upsert Pattern)
Currently, we implement upsert logic manually using conditional execution.
Example: Ensuring single
"GTM"node for 1,000 referencesThis works (validated in testing), but has significant drawbacks:
Proposed Solution (AI Generated proposal)
Add a built-in
upsert_nfunction to the modern Rust DSL:Or (option 2: builder pattern):
Behavior:
This ensures:
"GTM"creates 1 node, not 1,000 duplicatesUpsertNComparison: HelixQL vs Modern Rust DSL
HelixQL (legacy - simple and concise):
2 lines of code
Modern Rust DSL (current manual pattern - verbose):
13 lines of code
The verbosity gap (2 lines → 13 lines) creates a significant barrier when implementing this pattern across many entity types.
Benefits of Built-in Upsert
✅ Simplicity - 2-3 lines vs 20+ lines of boilerplate
✅ Maintainability - Less code to maintain per entity type
✅ Readability - Intent is clear (upsert vs conditional logic)
✅ Error Prevention - Single source of truth for properties
✅ Feature Parity - Matches HelixQL's
UpsertNcapability in modern DSL✅ Migration Path - Eases transition from legacy HelixQL to production Rust DSL
Migration Path from Legacy
For teams using HelixQL's
UpsertN, providing a Rust DSL equivalent would ease migration to the production-standard architecture without losing critical functionality.Questions for HelixDB Team
Conclusion
A built-in
upsert_nfunction would:We're excited about using HelixDB for this project and believe this feature would strengthen the modern Rust DSL significantly.
Thank you for considering this feature request!
Tested on: HelixDB 2.0.1, Rust SDK 2.0
Beta Was this translation helpful? Give feedback.
All reactions