<!-- CANARY: REQ=REQ-DOCS-001; FEATURE="Docs"; ASPECT=Documentation; STATUS=TESTED; OWNER=docs; UPDATED=2026-01-15 --> <h2 id="tutorials--guides" class="position-relative d-flex align-items-center group"> <span>Tutorials &amp;amp; Guides</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="tutorials--guides" aria-haspopup="dialog" aria-label="Share link: Tutorials &amp;amp; Guides"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h2><div id="headingShareModal" class="heading-share-modal" role="dialog" aria-modal="true" aria-labelledby="headingShareTitle" hidden> <div class="hsm-dialog" role="document"> <div class="hsm-header"> <h2 id="headingShareTitle" class="h6 mb-0 fw-bold">Share this section</h2> <button type="button" class="hsm-close" aria-label="Close"> <i class="fa-solid fa-xmark"></i> </button> </div> <div class="hsm-body"> <label for="headingShareInput" class="form-label small text-muted mb-1 text-uppercase fw-bold" style="font-size: 0.7rem; letter-spacing: 0.5px;">Permalink</label> <div class="input-group mb-4 hsm-url-group"> <input id="headingShareInput" type="text" class="form-control font-monospace" readonly aria-readonly="true" style="font-size: 0.85rem;" /> <button class="btn btn-primary hsm-copy" type="button" aria-label="Copy" title="Copy"> <i class="fa-duotone fa-clipboard" aria-hidden="true"></i> </button> </div> <div class="small fw-bold mb-2 text-muted text-uppercase" style="font-size: 0.7rem; letter-spacing: 0.5px;">Share via</div> <div class="hsm-share-grid"> <a id="share-twitter" class="btn btn-outline-secondary w-100" target="_blank" rel="noopener noreferrer"> <i class="fa-brands fa-twitter me-2"></i>Twitter </a> <a id="share-linkedin" class="btn btn-outline-secondary w-100" target="_blank" rel="noopener noreferrer"> <i class="fa-brands fa-linkedin me-2"></i>LinkedIn </a> <a id="share-facebook" class="btn btn-outline-secondary w-100" target="_blank" rel="noopener noreferrer"> <i class="fa-brands fa-facebook me-2"></i>Facebook </a> </div> </div> </div> </div> <style> .heading-share-modal { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; background: rgba(0, 0, 0, 0.6); z-index: 1050; padding: 1rem; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); } .heading-share-modal[hidden] { display: none !important; } .hsm-dialog { max-width: 420px; width: 100%; background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #212529); border: 1px solid var(--bs-border-color, rgba(0,0,0,0.1)); border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); overflow: hidden; animation: hsm-fade-in 0.2s ease-out; } @keyframes hsm-fade-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } } [data-bs-theme="dark"] .hsm-dialog { background: #1e293b; border-color: rgba(255,255,255,0.1); color: #f8f9fa; } .hsm-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,0.1)); background: rgba(0,0,0,0.02); } [data-bs-theme="dark"] .hsm-header { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.1); } .hsm-close { background: transparent; border: none; color: inherit; opacity: 0.5; padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-size: 1.2rem; line-height: 1; transition: opacity 0.2s; } .hsm-close:hover { opacity: 1; } .hsm-body { padding: 1.5rem; } .hsm-url-group { display: flex !important; align-items: stretch; } .hsm-url-group .form-control { flex: 1; min-width: 0; margin: 0; background: var(--bs-secondary-bg, #f8f9fa); border-color: var(--bs-border-color, #dee2e6); border-top-right-radius: 0; border-bottom-right-radius: 0; height: 42px; } .hsm-url-group .btn { flex: 0 0 auto; margin: 0; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; height: 42px; display: flex; align-items: center; justify-content: center; padding: 0 1.25rem; z-index: 2; } [data-bs-theme="dark"] .hsm-url-group .form-control { background: #0f172a; border-color: #334155; color: #e2e8f0; } .hsm-share-grid { display: flex; flex-direction: column; gap: 0.5rem; } .hsm-share-grid .btn { display: flex; align-items: center; justify-content: center; font-size: 0.9rem; padding: 0.6rem; border-color: var(--bs-border-color); width: 100%; } [data-bs-theme="dark"] .hsm-share-grid .btn { color: #e2e8f0; border-color: #475569; } [data-bs-theme="dark"] .hsm-share-grid .btn:hover { background: #334155; border-color: #cbd5e1; } </style> <script> (function(){ const modal = document.getElementById('headingShareModal'); if(!modal) return; const input = modal.querySelector('#headingShareInput'); const copyBtn = modal.querySelector('.hsm-copy'); const twitter = modal.querySelector('#share-twitter'); const linkedin = modal.querySelector('#share-linkedin'); const facebook = modal.querySelector('#share-facebook'); const closeBtn = modal.querySelector('.hsm-close'); let lastFocus=null; let trapBound=false; function buildUrl(id){ return window.location.origin + window.location.pathname + '#' + id; } function isOpen(){ return !modal.hasAttribute('hidden'); } function hydrate(id){ const url=buildUrl(id); input.value=url; const enc=encodeURIComponent(url); const text=encodeURIComponent(document.title); if(twitter) twitter.href=`https://twitter.com/intent/tweet?url=${enc}&text=${text}`; if(linkedin) linkedin.href=`https://www.linkedin.com/sharing/share-offsite/?url=${enc}`; if(facebook) facebook.href=`https://www.facebook.com/sharer/sharer.php?u=${enc}`; } function openModal(id){ lastFocus=document.activeElement; hydrate(id); if(!isOpen()){ modal.removeAttribute('hidden'); } requestAnimationFrame(()=>{ input.focus(); }); trapFocus(); } function closeModal(){ if(!isOpen()) return; modal.setAttribute('hidden',''); if(lastFocus && typeof lastFocus.focus==='function') lastFocus.focus(); } function copyCurrent(){ try{ navigator.clipboard.writeText(input.value).then(()=>feedback(true),()=>fallback()); } catch(e){ fallback(); } } function fallback(){ input.select(); try{ document.execCommand('copy'); feedback(true);}catch(e){ feedback(false);} } function feedback(ok){ if(!copyBtn) return; const icon=copyBtn.querySelector('i'); if(!icon) return; const prev=copyBtn.getAttribute('data-prev')||icon.className; if(!copyBtn.getAttribute('data-prev')) copyBtn.setAttribute('data-prev',prev); icon.className= ok ? 'fa-duotone fa-clipboard-check':'fa-duotone fa-circle-exclamation'; setTimeout(()=>{ icon.className=prev; },1800); } function handleShareClick(e){ e.preventDefault(); const btn=e.currentTarget; const id=btn.getAttribute('data-share-target'); if(id) openModal(id); } function bindShareButtons(){ document.querySelectorAll('.h-share').forEach(btn=>{ if(!btn.dataset.hShareBound){ btn.addEventListener('click', handleShareClick); btn.dataset.hShareBound='1'; } }); } bindShareButtons(); if(document.readyState==='loading'){ document.addEventListener('DOMContentLoaded', bindShareButtons); } else { requestAnimationFrame(bindShareButtons); } document.addEventListener('click', function(e){ const shareBtn=e.target.closest && e.target.closest('.h-share'); if(shareBtn && !shareBtn.dataset.hShareBound){ handleShareClick.call(shareBtn, e); } }, true); document.addEventListener('click', e=>{ if(e.target===modal) closeModal(); if(e.target.closest && e.target.closest('.hsm-close')){ e.preventDefault(); closeModal(); } if(copyBtn && (e.target===copyBtn || (e.target.closest && e.target.closest('.hsm-copy')))) { e.preventDefault(); copyCurrent(); } }); document.addEventListener('keydown', e=>{ if(e.key==='Escape' && isOpen()) closeModal(); }); function trapFocus(){ if(trapBound) return; trapBound=true; modal.addEventListener('keydown', f=>{ if(f.key==='Tab' && isOpen()){ const focusable=[...modal.querySelectorAll('a[href],button,input,textarea,select,[tabindex]:not([tabindex="-1"])')].filter(el=>!el.hasAttribute('disabled')); if(!focusable.length) return; const first=focusable[0]; const last=focusable[focusable.length-1]; if(f.shiftKey && document.activeElement===first){ f.preventDefault(); last.focus(); } else if(!f.shiftKey && document.activeElement===last){ f.preventDefault(); first.focus(); } } }); } if(closeBtn) closeBtn.addEventListener('click', e=>{ e.preventDefault(); closeModal(); }); })(); </script><p>Welcome to Geode&rsquo;s comprehensive tutorial collection. Whether you&rsquo;re new to graph databases or transitioning from other systems, these tutorials provide structured, hands-on learning paths to master Geode and the ISO/IEC 39075:2024 GQL standard.</p> <h3 id="learning-geode-through-tutorials" class="position-relative d-flex align-items-center group"> <span>Learning Geode Through Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="learning-geode-through-tutorials" aria-haspopup="dialog" aria-label="Share link: Learning Geode Through Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p>Tutorials are your fastest path to productive graph database development. Unlike reference documentation that explains <em>what</em> features exist, tutorials show <em>how</em> to use them through practical, goal-oriented examples that build your skills incrementally.</p> <h4 id="why-tutorial-based-learning-works" class="position-relative d-flex align-items-center group"> <span>Why Tutorial-Based Learning Works</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="why-tutorial-based-learning-works" aria-haspopup="dialog" aria-label="Share link: Why Tutorial-Based Learning Works"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p><strong>Structured Progression</strong>: Tutorials guide you from basic concepts to advanced techniques in a logical sequence. You start with simple node creation, progress to complex pattern matching, and eventually master transactions, security policies, and performance optimization.</p> <p><strong>Hands-On Practice</strong>: Every tutorial includes executable code examples. You learn by doing, not just reading. Whether you&rsquo;re using Python&rsquo;s async client, Go&rsquo;s database/sql driver, or Rust&rsquo;s high-performance tokio integration, you&rsquo;ll write real code that runs against a real database.</p> <p><strong>Context and Purpose</strong>: Tutorials explain not just the syntax but the reasoning behind design decisions. You&rsquo;ll understand <em>why</em> GQL uses declarative pattern matching instead of imperative traversals, and <em>when</em> to use subqueries versus OPTIONAL MATCH clauses.</p> <p><strong>Error Prevention</strong>: Good tutorials anticipate common mistakes and show you how to avoid them. You&rsquo;ll learn why relationship direction matters in pattern matching, how to prevent injection vulnerabilities in dynamic queries, and when to use transactions versus individual statements.</p> <h3 id="tutorial-categories-in-geode" class="position-relative d-flex align-items-center group"> <span>Tutorial Categories in Geode</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="tutorial-categories-in-geode" aria-haspopup="dialog" aria-label="Share link: Tutorial Categories in Geode"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3> <h4 id="getting-started-tutorials" class="position-relative d-flex align-items-center group"> <span>Getting Started Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="getting-started-tutorials" aria-haspopup="dialog" aria-label="Share link: Getting Started Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>Begin your journey with installation, basic configuration, and your first GQL queries. These tutorials assume no prior graph database experience and introduce fundamental concepts like nodes, relationships, properties, and pattern matching.</p> <p><strong>First Steps</strong>: Install Geode, start the server, connect with a client, and execute your first CREATE, MATCH, and RETURN statements. Within 15 minutes, you&rsquo;ll have a working graph database storing and querying connected data.</p> <p><strong>Data Modeling</strong>: Learn how to represent real-world entities and relationships as graph structures. Unlike relational databases where you normalize data into tables, graph modeling focuses on connections. A social network tutorial might show how users, posts, comments, and likes form a natural graph structure that&rsquo;s easier to query than SQL joins.</p> <p><strong>Basic Queries</strong>: Master the core GQL operations—CREATE for inserting data, MATCH for finding patterns, SET for updates, and DELETE for removal. Each tutorial provides multiple examples with increasing complexity, from single-node queries to multi-hop relationship traversals.</p> <h4 id="client-integration-tutorials" class="position-relative d-flex align-items-center group"> <span>Client Integration Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="client-integration-tutorials" aria-haspopup="dialog" aria-label="Share link: Client Integration Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>Geode provides production-ready clients in Python, Go, Rust, and Zig. Each language has its own idioms and patterns for database interaction.</p> <p><strong>Python Async Client</strong>: Build asynchronous applications using Python&rsquo;s async/await syntax. Learn connection pooling for high-throughput scenarios (workload dependent), context managers for transaction handling, and type-safe parameter binding. Example applications include web API backends using FastAPI and data processing pipelines.</p> <p><strong>Go database/sql Driver</strong>: Integrate Geode into Go applications using the standard database/sql interface. This tutorial covers prepared statements, connection lifecycle management, error handling with GQL status codes, and concurrent query execution. You&rsquo;ll build a REST API that exposes graph data through HTTP endpoints.</p> <p><strong>Rust High-Performance Client</strong>: Leverage Rust&rsquo;s zero-cost abstractions and tokio runtime for maximum throughput (workload dependent). Learn about the query builder API, connection pooling, async streams for result iteration, and integration with web frameworks like Axum and Actix.</p> <p><strong>Zig Native Client</strong>: For systems programming and embedded scenarios, the Zig client provides direct control over memory allocation and error handling. This tutorial shows how to integrate Geode into low-level applications requiring predictable performance and minimal overhead.</p> <h4 id="query-pattern-tutorials" class="position-relative d-flex align-items-center group"> <span>Query Pattern Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="query-pattern-tutorials" aria-haspopup="dialog" aria-label="Share link: Query Pattern Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>GQL&rsquo;s declarative pattern matching is fundamentally different from SQL&rsquo;s procedural joins. These tutorials build your intuition for expressing complex graph traversals concisely.</p> <p><strong>Pattern Matching Fundamentals</strong>: Learn how <code>MATCH (a:Person)-[:KNOWS]-&gt;(b:Person)</code> declares a relationship pattern that Geode resolves efficiently. Understand node variables, relationship types, property filters, and direction constraints.</p> <p><strong>Multi-Hop Traversals</strong>: Find paths through your graph using variable-length relationships. <code>MATCH (a)-[:FOLLOWS*1..3]-&gt;(b)</code> finds users within three degrees of separation. Learn when to use bounded versus unbounded traversals and how Geode optimizes path finding.</p> <p><strong>Subqueries and Composition</strong>: Break complex queries into manageable pieces using subqueries. Calculate aggregations, filter based on connected subgraphs, or return transformed results. Understand how subqueries enable reusable query components.</p> <p><strong>OPTIONAL MATCH</strong>: Handle missing data gracefully using OPTIONAL patterns. Unlike SQL&rsquo;s LEFT JOIN, OPTIONAL MATCH preserves graph structure while allowing null values for absent relationships. Learn when to use OPTIONAL versus multiple queries.</p> <h4 id="transaction-and-concurrency-tutorials" class="position-relative d-flex align-items-center group"> <span>Transaction and Concurrency Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="transaction-and-concurrency-tutorials" aria-haspopup="dialog" aria-label="Share link: Transaction and Concurrency Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>Production applications require transactional consistency and concurrent access patterns.</p> <p><strong>ACID Transactions</strong>: Every Geode operation supports full ACID semantics—atomicity, consistency, isolation, and durability. Learn how to group multiple queries into transactions, handle rollback scenarios, and use savepoints for partial rollback.</p> <p><strong>Isolation Levels</strong>: Understand how Geode&rsquo;s SERIALIZABLE isolation prevents anomalies like dirty reads, non-repeatable reads, and phantom reads. Learn the performance implications and when snapshot isolation is sufficient.</p> <p><strong>Concurrent Patterns</strong>: Build applications that handle multiple simultaneous clients safely. Learn optimistic locking strategies, retry logic for transaction conflicts, and connection pool configuration for maximum throughput.</p> <p><strong>Distributed Transactions</strong>: For applications spanning multiple data stores, learn integration patterns with external systems while maintaining consistency guarantees.</p> <h4 id="security-and-access-control-tutorials" class="position-relative d-flex align-items-center group"> <span>Security and Access Control Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="security-and-access-control-tutorials" aria-haspopup="dialog" aria-label="Share link: Security and Access Control Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>Geode&rsquo;s Row-Level Security (RLS) provides fine-grained access control at the data level, not just the table level.</p> <p><strong>Authentication Setup</strong>: Configure TLS certificates, set up user credentials, and integrate with external authentication providers. Geode requires TLS 1.3 for all connections, ensuring data is encrypted in transit.</p> <p><strong>Role-Based Access</strong>: Define roles with specific capabilities—read-only users, editors who can modify data, and administrators with schema privileges. Learn policy composition for complex authorization rules.</p> <p><strong>Row-Level Security Policies</strong>: Restrict query results based on user identity and data properties. A multi-tenant application might use RLS to ensure users only see their organization&rsquo;s data, even when querying shared tables. The database enforces policies automatically without application-level filtering.</p> <p><strong>Audit Logging</strong>: Track who accessed what data and when. Implement comprehensive audit trails for compliance requirements in regulated industries.</p> <h4 id="performance-and-optimization-tutorials" class="position-relative d-flex align-items-center group"> <span>Performance and Optimization Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="performance-and-optimization-tutorials" aria-haspopup="dialog" aria-label="Share link: Performance and Optimization Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><p>Scalable applications require understanding query performance characteristics and optimization techniques.</p> <p><strong>Query Profiling</strong>: Use Geode&rsquo;s PROFILE command to understand query execution plans. Identify bottlenecks like full table scans, unindexed property lookups, or inefficient join strategies.</p> <p><strong>Index Design</strong>: Learn which queries benefit from indexes and how to create them. Property indexes accelerate equality and range lookups. Relationship indexes speed up traversals from specific node types.</p> <p><strong>Caching Strategies</strong>: Implement application-level caching for frequently accessed data. Understand cache invalidation patterns and when to use client-side versus server-side caching.</p> <p><strong>Bulk Operations</strong>: Load large datasets efficiently using batch inserts and COPY commands. Learn partitioning strategies for parallel data loading and how to maintain index consistency during bulk operations.</p> <h3 id="code-examples-across-languages" class="position-relative d-flex align-items-center group"> <span>Code Examples Across Languages</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="code-examples-across-languages" aria-haspopup="dialog" aria-label="Share link: Code Examples Across Languages"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p>Every tutorial provides working code in multiple languages, demonstrating idiomatic patterns for each ecosystem.</p> <h4 id="python-example-creating-and-querying-a-social-graph" class="position-relative d-flex align-items-center group"> <span>Python Example: Creating and Querying a Social Graph</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="python-example-creating-and-querying-a-social-graph" aria-haspopup="dialog" aria-label="Share link: Python Example: Creating and Querying a Social Graph"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">asyncio</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">geode_client</span> <span class="kn">import</span> <span class="n">Client</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">async</span> <span class="k">def</span> <span class="nf">social_graph_example</span><span class="p">():</span> </span></span><span class="line"><span class="cl"> <span class="n">client</span> <span class="o">=</span> <span class="n">Client</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s2">&#34;localhost&#34;</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">3141</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="k">async</span> <span class="k">with</span> <span class="n">client</span><span class="o">.</span><span class="n">connection</span><span class="p">()</span> <span class="k">as</span> <span class="n">conn</span><span class="p">:</span> </span></span><span class="line"><span class="cl"> <span class="c1"># Create users with a transaction</span> </span></span><span class="line"><span class="cl"> <span class="k">async</span> <span class="k">with</span> <span class="n">client</span><span class="o">.</span><span class="n">connection</span><span class="p">()</span> <span class="k">as</span> <span class="n">tx</span><span class="p">:</span> </span></span><span class="line"><span class="cl"> <span class="k">await</span> <span class="n">tx</span><span class="o">.</span><span class="n">begin</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="k">await</span> <span class="n">tx</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&#34;&#34;&#34; </span></span></span><span class="line"><span class="cl"><span class="s2"> CREATE (alice:Person {name: &#39;Alice&#39;, age: 30}) </span></span></span><span class="line"><span class="cl"><span class="s2"> CREATE (bob:Person {name: &#39;Bob&#39;, age: 25}) </span></span></span><span class="line"><span class="cl"><span class="s2"> CREATE (alice)-[:KNOWS </span><span class="si">{since: 2020}</span><span class="s2">]-&gt;(bob) </span></span></span><span class="line"><span class="cl"><span class="s2"> &#34;&#34;&#34;</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1"># Query friends of friends</span> </span></span><span class="line"><span class="cl"> <span class="n">result</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="k">await</span> <span class="n">conn</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="s2">&#34;&#34;&#34; </span></span></span><span class="line"><span class="cl"><span class="s2"> MATCH (a:Person {name: &#39;Alice&#39;})-[:KNOWS*1..2]-&gt;(friend) </span></span></span><span class="line"><span class="cl"><span class="s2"> RETURN DISTINCT friend.name, friend.age </span></span></span><span class="line"><span class="cl"><span class="s2"> ORDER BY friend.name </span></span></span><span class="line"><span class="cl"><span class="s2"> &#34;&#34;&#34;</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">rows</span><span class="p">:</span> </span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&#34;Friend: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="s1">&#39;friend.name&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2">, Age: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="s1">&#39;friend.age&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2">&#34;</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">social_graph_example</span><span class="p">())</span> </span></span></code></pre></div> <h4 id="go-example-product-recommendations" class="position-relative d-flex align-items-center group"> <span>Go Example: Product Recommendations</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="go-example-product-recommendations" aria-haspopup="dialog" aria-label="Share link: Go Example: Product Recommendations"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">main</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s">&#34;context&#34;</span> </span></span><span class="line"><span class="cl"> <span class="s">&#34;database/sql&#34;</span> </span></span><span class="line"><span class="cl"> <span class="s">&#34;fmt&#34;</span> </span></span><span class="line"><span class="cl"> <span class="nx">_</span> <span class="s">&#34;geodedb.com/geode&#34;</span> </span></span><span class="line"><span class="cl"><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">db</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">sql</span><span class="p">.</span><span class="nf">Open</span><span class="p">(</span><span class="s">&#34;geode&#34;</span><span class="p">,</span> <span class="s">&#34;quic://localhost:3141&#34;</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="k">defer</span> <span class="nx">db</span><span class="p">.</span><span class="nf">Close</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Find products similar to what user purchased </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">rows</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">db</span><span class="p">.</span><span class="nf">QueryContext</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">(),</span> <span class="s">` </span></span></span><span class="line"><span class="cl"><span class="s"> MATCH (u:User {id: $userId})-[:PURCHASED]-&gt;(p:Product) </span></span></span><span class="line"><span class="cl"><span class="s"> -[:SIMILAR_TO]-&gt;(rec:Product) </span></span></span><span class="line"><span class="cl"><span class="s"> WHERE NOT EXISTS { </span></span></span><span class="line"><span class="cl"><span class="s"> MATCH (u)-[:PURCHASED]-&gt;(rec) </span></span></span><span class="line"><span class="cl"><span class="s"> } </span></span></span><span class="line"><span class="cl"><span class="s"> RETURN rec.name, rec.price </span></span></span><span class="line"><span class="cl"><span class="s"> ORDER BY rec.price </span></span></span><span class="line"><span class="cl"><span class="s"> LIMIT 5 </span></span></span><span class="line"><span class="cl"><span class="s"> `</span><span class="p">,</span> <span class="nx">sql</span><span class="p">.</span><span class="nf">Named</span><span class="p">(</span><span class="s">&#34;userId&#34;</span><span class="p">,</span> <span class="s">&#34;user123&#34;</span><span class="p">))</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="k">defer</span> <span class="nx">rows</span><span class="p">.</span><span class="nf">Close</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="nx">rows</span><span class="p">.</span><span class="nf">Next</span><span class="p">()</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">name</span> <span class="kt">string</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">price</span> <span class="kt">float64</span> </span></span><span class="line"><span class="cl"> <span class="nx">rows</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">name</span><span class="p">,</span> <span class="o">&amp;</span><span class="nx">price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Printf</span><span class="p">(</span><span class="s">&#34;Recommendation: %s ($%.2f)\n&#34;</span><span class="p">,</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre></div> <h4 id="rust-example-high-throughput-event-processing" class="position-relative d-flex align-items-center group"> <span>Rust Example: High-Throughput Event Processing</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="rust-example-high-throughput-event-processing" aria-haspopup="dialog" aria-label="Share link: Rust Example: High-Throughput Event Processing"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h4><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-rust" data-lang="rust"><span class="line"><span class="cl"><span class="k">use</span><span class="w"> </span><span class="n">geode_client</span>::<span class="p">{</span><span class="n">Client</span><span class="p">,</span><span class="w"> </span><span class="n">QueryBuilder</span><span class="p">};</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">use</span><span class="w"> </span><span class="n">tokio</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="cp">#[tokio::main]</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">async</span><span class="w"> </span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nb">Result</span><span class="o">&lt;</span><span class="p">(),</span><span class="w"> </span><span class="nb">Box</span><span class="o">&lt;</span><span class="k">dyn</span><span class="w"> </span><span class="n">std</span>::<span class="n">error</span>::<span class="n">Error</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">client</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Client</span>::<span class="n">connect</span><span class="p">(</span><span class="s">&#34;localhost:3141&#34;</span><span class="p">).</span><span class="k">await</span><span class="o">?</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c1">// Stream events and create graph relationships in real-time </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">query</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">QueryBuilder</span>::<span class="n">new</span><span class="p">()</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">match_pattern</span><span class="p">(</span><span class="s">&#34;(e:Event)&#34;</span><span class="p">)</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">where_clause</span><span class="p">(</span><span class="s">&#34;e.timestamp &gt; $cutoff&#34;</span><span class="p">)</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">return_clause</span><span class="p">(</span><span class="s">&#34;e.id, e.type, e.user_id&#34;</span><span class="p">)</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">build</span><span class="p">();</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">results</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">client</span><span class="p">.</span><span class="n">execute</span><span class="p">(</span><span class="o">&amp;</span><span class="n">query</span><span class="p">)</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">bind</span><span class="p">(</span><span class="s">&#34;cutoff&#34;</span><span class="p">,</span><span class="w"> </span><span class="s">&#34;2025-01-01T00:00:00Z&#34;</span><span class="p">)</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="n">stream</span><span class="p">()</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">.</span><span class="k">await</span><span class="o">?</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">row</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">results</span><span class="p">.</span><span class="n">next</span><span class="p">().</span><span class="k">await</span><span class="w"> </span><span class="p">{</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">event_id</span>: <span class="nb">String</span> <span class="o">=</span><span class="w"> </span><span class="n">row</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#34;e.id&#34;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">event_type</span>: <span class="nb">String</span> <span class="o">=</span><span class="w"> </span><span class="n">row</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#34;e.type&#34;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c1">// Process events at 10,000+ per second </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="w"> </span><span class="fm">println!</span><span class="p">(</span><span class="s">&#34;Processing event: </span><span class="si">{}</span><span class="s"> (</span><span class="si">{}</span><span class="s">)&#34;</span><span class="p">,</span><span class="w"> </span><span class="n">event_id</span><span class="p">,</span><span class="w"> </span><span class="n">event_type</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nb">Ok</span><span class="p">(())</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="p">}</span><span class="w"> </span></span></span></code></pre></div> <h3 id="best-practices-from-tutorials" class="position-relative d-flex align-items-center group"> <span>Best Practices from Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="best-practices-from-tutorials" aria-haspopup="dialog" aria-label="Share link: Best Practices from Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p>Through hands-on examples, you&rsquo;ll internalize these production-ready practices:</p> <p><strong>Parameterized Queries</strong>: Always use parameter binding instead of string concatenation to prevent GQL injection attacks. Every client library provides safe parameter mechanisms.</p> <p><strong>Connection Pooling</strong>: Don&rsquo;t create a new connection for every query. Use connection pools to amortize TLS handshake costs and maintain persistent connections to the server.</p> <p><strong>Transaction Boundaries</strong>: Keep transactions short and focused. Long-running transactions hold locks and can impact concurrency. Commit or rollback promptly.</p> <p><strong>Error Handling</strong>: Implement retry logic for transient failures like network timeouts or transaction conflicts. Distinguish between retryable errors and permanent failures.</p> <p><strong>Resource Cleanup</strong>: Use language-specific resource management patterns—Python&rsquo;s <code>async with</code>, Go&rsquo;s <code>defer</code>, Rust&rsquo;s Drop trait—to ensure connections and transactions are properly closed even during errors.</p> <h3 id="common-tutorial-pitfalls-and-solutions" class="position-relative d-flex align-items-center group"> <span>Common Tutorial Pitfalls and Solutions</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="common-tutorial-pitfalls-and-solutions" aria-haspopup="dialog" aria-label="Share link: Common Tutorial Pitfalls and Solutions"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p><strong>Pitfall: Cartesian Product Queries</strong> Forgetting relationship constraints causes queries to return every possible node combination. Always connect patterns with relationships or WHERE clauses.</p> <p><strong>Pitfall: Unbounded Traversals</strong> <code>MATCH (a)-[:CONNECTED*]-&gt;(b)</code> without a maximum hop count can traverse the entire graph. Use bounded ranges like <code>[:CONNECTED*1..5]</code> unless you specifically need unlimited depth.</p> <p><strong>Pitfall: Property Access Without Checks</strong> Accessing properties that might not exist causes runtime errors. Use OPTIONAL MATCH or COALESCE() for nullable properties.</p> <p><strong>Pitfall: Ignoring Transaction Boundaries</strong> Relying on auto-commit for multi-step operations leads to inconsistent state if intermediate steps fail. Explicitly manage transactions for related operations.</p> <h3 id="interactive-learning-resources" class="position-relative d-flex align-items-center group"> <span>Interactive Learning Resources</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="interactive-learning-resources" aria-haspopup="dialog" aria-label="Share link: Interactive Learning Resources"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p><strong>Geode Shell</strong>: The interactive REPL lets you experiment with queries immediately. Type <code>geode shell</code> to start exploring your data interactively with syntax highlighting and auto-completion.</p> <p><strong>Test Harness</strong>: Run the cross-client test harness to see working examples in all languages executing the same queries. Learn how different clients handle parameters, results, and errors.</p> <p><strong>Sample Datasets</strong>: Load pre-built datasets representing common domains—social networks, product catalogs, knowledge graphs, security policies. Learn through realistic scenarios rather than toy examples.</p> <h3 id="progressive-tutorial-paths" class="position-relative d-flex align-items-center group"> <span>Progressive Tutorial Paths</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="progressive-tutorial-paths" aria-haspopup="dialog" aria-label="Share link: Progressive Tutorial Paths"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p><strong>Beginner Path (Week 1)</strong>: Installation, basic CRUD, simple pattern matching, single-client integration.</p> <p><strong>Intermediate Path (Week 2-3)</strong>: Complex queries, transactions, security policies, connection pooling, error handling.</p> <p><strong>Advanced Path (Week 4+)</strong>: Performance optimization, distributed systems integration, custom client implementation, production deployment.</p> <h3 id="community-tutorials" class="position-relative d-flex align-items-center group"> <span>Community Tutorials</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="community-tutorials" aria-haspopup="dialog" aria-label="Share link: Community Tutorials"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p>Beyond official documentation, the Geode community creates tutorials for specific use cases:</p> <ul> <li>E-commerce recommendation systems</li> <li>Fraud detection in financial networks</li> <li>Social network analysis and influence graphs</li> <li>Knowledge graph construction from text</li> <li>Real-time event correlation</li> <li>Multi-tenant SaaS architectures</li> </ul> <h3 id="next-steps" class="position-relative d-flex align-items-center group"> <span>Next Steps</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="next-steps" aria-haspopup="dialog" aria-label="Share link: Next Steps"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><p>Start with the Getting Started tutorial to install Geode and execute your first queries. Then explore client-specific tutorials for your programming language. As you build proficiency, tackle performance optimization and security hardening tutorials to prepare for production deployment.</p> <p>Every tutorial builds on previous knowledge while standing alone as a reference for specific techniques. Learn at your own pace, experiment freely in development environments, and apply lessons to your production use cases.</p> <h3 id="related-topics" class="position-relative d-flex align-items-center group"> <span>Related Topics</span> <button type="button" class="h-share btn btn-link p-0 text-decoration-none link-secondary opacity-50 hover-opacity-100 transition-all ms-1" data-share-target="related-topics" aria-haspopup="dialog" aria-label="Share link: Related Topics"> <i class="fa-sharp-duotone fa-solid fa-share-nodes" aria-hidden="true" style="font-size: 0.8em;"></i> <span class="visually-hidden">Share link</span> </button> </h3><ul> <li><strong>Examples</strong>: Working code snippets demonstrating specific features</li> <li><strong>Guides</strong>: In-depth explanations of concepts and architectures</li> <li><strong>Quick Start</strong>: Condensed tutorials for rapid initial setup</li> <li><strong>Hands-On Learning</strong>: Interactive exercises and challenges</li> <li><strong>Developer Guide</strong>: Comprehensive reference for building on Geode</li> </ul>

Related Articles