Nemo Logo
Nemo
Nemo / examples

Nemo Examples

Browse the GitHub examples guide and expand any example to load its Python source directly from the Nemo repository.

Nemo Python SDK Examples Guide

This directory contains 50 comprehensive, self-contained executable examples covering every operational capability, relational feature, SQL function, concurrency model, and analytical pipeline in the Nemo database engine (nemo-py).


Complete Index of Examples (1 – 50)

Category 1: Core Operations & Table Schemas

Example Topic / Feature Demonstrated Run Command
example_1.py Basic synchronous CRUD, auto-increment keys, single inserts, batch executemany, updates, deletes, and instant truncate(). python example/example_1.py
example_2.py Asynchronous operations with asyncio, coroutine workers, async with, async batching, and AsyncConnectionPool. python example/example_2.py
example_3.py Demonstration of all 30 native SQL datatypes (Primitives, Collections, Temporals, Arrays, Dicts, JSON, UUID, IP/CIDR, Ranges). python example/example_3.py
example_4.py Built-in SQL functions for JSON extraction, array manipulation, dict lookup, string, math, and range boundaries. python example/example_4.py
example_5.py High-speed in-memory hash joins with selective column projection, SIMD aggregates, window ranking, and CBO query planning. python example/example_5.py
example_6.py High-velocity FIFO queue and LIFO stack operations using native atomic popping (conn.pop()) at 7M+ ops/second. python example/example_6.py
example_7.py Database sequences (nextval, currval) and atomic batch ID range reservation (allocate_id_range) for multi-worker ingestion. python example/example_7.py
example_8.py Direct columnar data extraction API (conn.extract_columnar()) bypassing row-by-row tuple wrapping for analytical pipelines. python example/example_8.py
example_9.py ACID transactions, automatic rollbacks on exceptions, manual commits/rollbacks, and snapshot isolation. python example/example_9.py
example_10.py Multi-threaded synchronous connection pooling, thread-safe lease acquisition, and concurrent stress testing with zero lock collisions. python example/example_10.py

Category 2: Prepared Statements & Metadata Reflection

Example Topic / Feature Demonstrated Run Command
example_11.py Parameterized queries (?), SQL injection prevention, and reusable prepared statements (conn.prepare()). python example/example_11.py
example_12.py Query performance diagnostics and execution profiling via result.statistics (buffer hits, planning/execution times). python example/example_12.py
example_13.py Schema reflection and column metadata inspection (result.columns, types, table origin, nullability). python example/example_13.py
example_14.py High-speed table truncation and instantaneous O(1) storage reclamation (conn.truncate()). python example/example_14.py

Category 3: Datatypes & Rich Encodings

Example Topic / Feature Demonstrated Run Command
example_15.py Numeric datatypes deep-dive (TINYINT, SMALLINT, INTEGER, BIGINT, REAL, DOUBLE, boundary testing). python example/example_15.py
example_16.py Exact financial decimals (DECIMAL), preventing binary floating-point rounding errors in banking ledgers. python example/example_16.py
example_17.py Text, international Unicode, and raw cryptographic binary blobs (VARCHAR, TEXT, BYTEA). python example/example_17.py
example_18.py Temporal types and time-series scheduling (DATE, TIME, TIMESTAMP, TIMESTAMPTZ, INTERVAL). python example/example_18.py
example_19.py Semi-structured JSON and binary JSONB document storage, querying, and updates. python example/example_19.py
example_20.py Native structured collection types: ordered dynamic ARRAY and key-value DICT. python example/example_20.py
example_21.py System & networking types: UUID, IP addresses (INET, CIDR), MAC addresses, and RANGE intervals. python example/example_21.py

Category 4: In-Built SQL Functions

Example Topic / Feature Demonstrated Run Command
example_22.py Native JSON SQL functions: json_extract, json_length, json_contains, and json_set. python example/example_22.py
example_23.py Collection SQL functions: array_get, array_sum, array_avg, array_append, dict_get, dict_has_key. python example/example_23.py
example_24.py String SQL functions: upper, lower, concat, substring, and trim. python example/example_24.py
example_25.py Mathematical SQL expressions: abs, round, sqrt, power, and mod. python example/example_25.py
example_26.py Range, network & utility functions: range_lower, range_upper, range_contains, host, netmask, coalesce. python example/example_26.py

Category 5: Relational & Analytical Queries

Example Topic / Feature Demonstrated Run Command
example_27.py Multi-table relational hash joins with predicate pushdown and selective column projections. python example/example_27.py
example_28.py SIMD vectorized aggregate processing (AVX2/NEON 1024-element chunks for SUM, AVG, MIN, MAX). python example/example_28.py
example_29.py Analytical window ranking functions: ROW_NUMBER() and RANK() OVER (ORDER BY ...). python example/example_29.py
example_30.py Cost-Based Optimizer (CBO) and physical plan tree inspection with conn.explain(). python example/example_30.py
example_31.py Common Table Expressions (CTEs) using WITH ... AS (...) for modular queries. python example/example_31.py
example_32.py Filter expressions and range queries using BETWEEN, equality, and compound conditions. python example/example_32.py

Category 6: Queues, Stacks & Sequences

Example Topic / Feature Demonstrated Run Command
example_33.py High-velocity background task processing with atomic FIFO queues (conn.pop(..., 'fifo')). python example/example_33.py
example_34.py Document revision undo stack and audit log popping using atomic LIFO operations (conn.pop(..., 'lifo')). python example/example_34.py
example_35.py Standalone atomic database sequences with nextval('seq') and currval('seq'). python example/example_35.py
example_36.py Zero-contention parallel ID range reservation blocks using conn.allocate_id_range(). python example/example_36.py

Category 7: High-Speed Extraction & Enterprise Architecture

Example Topic / Feature Demonstrated Run Command
example_37.py High-speed columnar data extraction into typed {col_name: [values]} dictionaries for analytical pipelines. python example/example_37.py
example_38.py Storage-level pushdown filtering and column projection using conn.extract(). python example/example_38.py
example_39.py ACID transaction safety, context manager auto-commit, and automatic rollback on Python exceptions. python example/example_39.py
example_40.py End-to-end e-commerce microservice platform integrating catalogs, orders, fulfillment queue, and SIMD analytics. python example/example_40.py

Category 8: Advanced Engine Mechanics & Architecture Deep-Dive

Example Topic / Feature Demonstrated Run Command
example_41.py Slotted page storage architecture: 4096-byte blocks, bottom-up record packing, and tombstone slot reuse without fragmentation. python example/example_41.py
example_42.py Buffer pool CLOCK eviction algorithm, second-chance referencing bits, and warm memory page cache hit ratios. python example/example_42.py
example_43.py Multi-Version Concurrency Control (MVCC) snapshot isolation: simultaneous readers and writers with zero lock contention. python example/example_43.py
example_44.py Write-Ahead Logging (WAL) and ARIES crash recovery mechanics: redo logs, undo rollback chains, and transaction durability. python example/example_44.py
example_45.py Cost-Based Optimizer (CBO) statistical distributions via conn.analyze() and physical query plan trees via conn.explain(). python example/example_45.py
example_46.py In-memory projected hash join algorithms: build and probe phases with column projection pushdown. python example/example_46.py
example_47.py Vectorized SIMD aggregations in 1024-element aligned CPU chunks (AVX2 / NEON) for ultra-fast SUM, AVG, MIN, MAX. python example/example_47.py
example_48.py Contention-free multi-worker partitioning using sequence atomic block reservations via conn.allocate_id_range(). python example/example_48.py
example_49.py B+ Tree indexing anatomy: point query index lookups vs contiguous sibling leaf pointer range scans (BETWEEN). python example/example_49.py
example_50.py Comprehensive master architecture showcase uniting pooling, transactions, hash joins, SIMD, queues, and columnar extraction. python example/example_50.py

Running the Examples

Each example is a standalone executable script that creates an isolated local database, executes the scenario, prints diagnostic output, and cleans up its database upon exit:

# Run any individual example
python example/example_1.py
python example/example_20.py
python example/example_40.py
python example/example_50.py

# Run all 50 examples sequentially
python -c "import subprocess, sys; [subprocess.run([sys.executable, f'example/example_{i}.py'], check=True) for i in range(1, 51)]"

Example source code

Choose an example to load its current source from GitHub.

EXAMPLE 1 Basic synchronous CRUD, auto-increment keys, single inserts, batch `executemany`, updates, deletes, and instant `truncate()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 2 Asynchronous operations with `asyncio`, coroutine workers, `async with`, async batching, and `AsyncConnectionPool`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 3 Demonstration of all 30 native SQL datatypes (Primitives, Collections, Temporals, Arrays, Dicts, JSON, UUID, IP/CIDR, Ranges). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 4 Built-in SQL functions for JSON extraction, array manipulation, dict lookup, string, math, and range boundaries. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 5 High-speed in-memory hash joins with selective column projection, SIMD aggregates, window ranking, and CBO query planning. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 6 High-velocity FIFO queue and LIFO stack operations using native atomic popping (`conn.pop()`) at 7M+ ops/second. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 7 Database sequences (`nextval`, `currval`) and atomic batch ID range reservation (`allocate_id_range`) for multi-worker ingestion. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 8 Direct columnar data extraction API (`conn.extract_columnar()`) bypassing row-by-row tuple wrapping for analytical pipelines. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 9 ACID transactions, automatic rollbacks on exceptions, manual commits/rollbacks, and snapshot isolation. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 10 Multi-threaded synchronous connection pooling, thread-safe lease acquisition, and concurrent stress testing with zero lock collisions. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 11 Parameterized queries (`?`), SQL injection prevention, and reusable prepared statements (`conn.prepare()`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 12 Query performance diagnostics and execution profiling via `result.statistics` (buffer hits, planning/execution times). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 13 Schema reflection and column metadata inspection (`result.columns`, types, table origin, nullability). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 14 High-speed table truncation and instantaneous O(1) storage reclamation (`conn.truncate()`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 15 Numeric datatypes deep-dive (`TINYINT`, `SMALLINT`, `INTEGER`, `BIGINT`, `REAL`, `DOUBLE`, boundary testing). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 16 Exact financial decimals (`DECIMAL`), preventing binary floating-point rounding errors in banking ledgers. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 17 Text, international Unicode, and raw cryptographic binary blobs (`VARCHAR`, `TEXT`, `BYTEA`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 18 Temporal types and time-series scheduling (`DATE`, `TIME`, `TIMESTAMP`, `TIMESTAMPTZ`, `INTERVAL`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 19 Semi-structured JSON and binary JSONB document storage, querying, and updates. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 20 Native structured collection types: ordered dynamic `ARRAY` and key-value `DICT`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 21 System & networking types: `UUID`, IP addresses (`INET`, `CIDR`), MAC addresses, and `RANGE` intervals. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 22 Native JSON SQL functions: `json_extract`, `json_length`, `json_contains`, and `json_set`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 23 Collection SQL functions: `array_get`, `array_sum`, `array_avg`, `array_append`, `dict_get`, `dict_has_key`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 24 String SQL functions: `upper`, `lower`, `concat`, `substring`, and `trim`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 25 Mathematical SQL expressions: `abs`, `round`, `sqrt`, `power`, and `mod`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 26 Range, network & utility functions: `range_lower`, `range_upper`, `range_contains`, `host`, `netmask`, `coalesce`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 27 Multi-table relational hash joins with predicate pushdown and selective column projections. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 28 SIMD vectorized aggregate processing (AVX2/NEON 1024-element chunks for `SUM`, `AVG`, `MIN`, `MAX`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 29 Analytical window ranking functions: `ROW_NUMBER()` and `RANK() OVER (ORDER BY ...)`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 30 Cost-Based Optimizer (CBO) and physical plan tree inspection with `conn.explain()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 31 Common Table Expressions (CTEs) using `WITH ... AS (...)` for modular queries. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 32 Filter expressions and range queries using `BETWEEN`, equality, and compound conditions. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 33 High-velocity background task processing with atomic FIFO queues (`conn.pop(..., 'fifo')`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 34 Document revision undo stack and audit log popping using atomic LIFO operations (`conn.pop(..., 'lifo')`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 35 Standalone atomic database sequences with `nextval('seq')` and `currval('seq')`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 36 Zero-contention parallel ID range reservation blocks using `conn.allocate_id_range()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 37 High-speed columnar data extraction into typed `{col_name: [values]}` dictionaries for analytical pipelines. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 38 Storage-level pushdown filtering and column projection using `conn.extract()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 39 ACID transaction safety, context manager auto-commit, and automatic rollback on Python exceptions. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 40 End-to-end e-commerce microservice platform integrating catalogs, orders, fulfillment queue, and SIMD analytics. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 41 Slotted page storage architecture: 4096-byte blocks, bottom-up record packing, and tombstone slot reuse without fragmentation. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 42 Buffer pool CLOCK eviction algorithm, second-chance referencing bits, and warm memory page cache hit ratios. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 43 Multi-Version Concurrency Control (MVCC) snapshot isolation: simultaneous readers and writers with zero lock contention. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 44 Write-Ahead Logging (WAL) and ARIES crash recovery mechanics: redo logs, undo rollback chains, and transaction durability. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 45 Cost-Based Optimizer (CBO) statistical distributions via `conn.analyze()` and physical query plan trees via `conn.explain()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 46 In-memory projected hash join algorithms: build and probe phases with column projection pushdown. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 47 Vectorized SIMD aggregations in 1024-element aligned CPU chunks (AVX2 / NEON) for ultra-fast `SUM`, `AVG`, `MIN`, `MAX`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 48 Contention-free multi-worker partitioning using sequence atomic block reservations via `conn.allocate_id_range()`. View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 49 B+ Tree indexing anatomy: point query index lookups vs contiguous sibling leaf pointer range scans (`BETWEEN`). View source

Source loads when expanded.

Open on GitHub ↗
EXAMPLE 50 Comprehensive master architecture showcase uniting pooling, transactions, hash joins, SIMD, queues, and columnar extraction. View source

Source loads when expanded.

Open on GitHub ↗