Streaming & Analytics
Loxtep provides two complementary data access modes: real-time event streaming for operational workloads and analytical SQL querying for exploratory and reporting use cases. Together they ensure data products are accessible for both event-driven architectures and ad-hoc analysis.
Event Streaming
Loxtep's event bus underpins real-time data processing. It handles ordered event delivery, backpressure management, and replay capabilities for data product workflows.
How Streaming Works
Events flow through the system as ordered records on named queues. Each data product's ingestion and delivery workflows read from and write to these queues:
Source system → Connector → Queue → Workflow → Data Product → Queue → Consumer
Queue Model
Event queues provide:
- Ordered delivery — events within a queue are strictly ordered.
- Durability — events are persisted and available for replay.
- Backpressure — slow consumers do not block producers; queues buffer.
- Checkpointing — consumers track their position for exactly-once processing.
Monitoring Queue Health
Track queue depth and throughput to understand processing health:
loxtep queue info dp_orders
This returns current depth, events per second, and consumer lag — key signals for identifying bottlenecks or stalled processors.
Event Replay
When a consumer needs to reprocess historical events (after a bug fix, schema change, or new consumer product creation), replay events from a specific time range:
{
"operation": "replay_events",
"data_product_id": "<data-product-uuid>",
"from_timestamp": "2025-01-01T00:00:00Z",
"limit": 1000
}
Replay re-emits events in original order, allowing consumers to rebuild their state from historical data.
Analytical SQL Querying
The analytics engine provides the analytical SQL interface for querying data products. Data products are exposed as queryable tables without requiring separate ETL pipelines or data warehouses.
Direct SQL Access
Query any data product using standard SQL:
SELECT order_id, customer_email, total_amount
FROM orders
WHERE total_amount > 10000
ORDER BY total_amount DESC
LIMIT 25;
SQL Query Interface
The SQL query interface bridges data products and the analytics engine. It handles:
- Table registration — data products appear as named tables automatically.
- Schema mapping — data product schemas translate to SQL column definitions.
- Access control — queries respect data product permissions.
- Resource isolation — analytical queries do not affect streaming throughput.
Available Operations
The analytics tool surface provides several operations:
| Operation | Purpose |
|---|---|
execute_query | Run a SQL query against data products |
list_tables | Discover available tables (data products) |
get_table_schema | Inspect column definitions for a table |
get_query_results | Retrieve results from a previously submitted query |
semantic_search | Rank Iceberg rows by embedding similarity |
Execute a query via the MCP tool surface:
{
"operation": "execute_query",
"query": "SELECT count(*) as total_orders, sum(total_amount) as revenue FROM orders WHERE created_at > '2025-01-01'"
}
Reading query results
A successful execute_query tool call (success: true) can still return
status: "partial". Check status on the result before treating rows as
complete.
When status is partial, tell the user the result is incomplete: cite
files_read of files_expected when those fields are present, and whether
sampled is true. Do not present counts or aggregates as complete. The result
may also include error (the warehouse reason, such as an Iceberg
parquet-fallback truncation), engine, applied_caps, iceberg_health_status,
iceberg_health_reason, and recovery
({ action: "rebuild_iceberg", data_product_id }). If sampled is true, the
rows are a bounded sample even when status is completed.
iceberg_health_status being set is not itself a rebuild signal. Treat these
warehouse statuses as follows (none include recovery, and none are a rebuild
signal):
retryable— transient metadata load (5xx / 408 / 429 / network). Retry the query. Do not rebuild.unauthorized— 401/403 on the S3 Tables metadata GET oriceberg_scan. The table itself was not checked. Do not rebuild.metadata_config_error— no transport / other 4xx / unclassified. Fix the proxy URL or metadata location. Do not rebuild.history_not_written— event history is on, but the history table has not been created. The query error is "Event history for this product hasn't been written yet." The schema tree keeps the entry, labels it "Not created yet", and loads no starter query. Wait for the first accepted event with a parsable eid (z/YYYY/MM/DD/HH/mm/...). An accepted event without a parsable eid does not create the table. Do not rebuild. A missing current-state table is unchanged.
Rebuild an Iceberg table only when recovery.action is rebuild_iceberg, or
iceberg_health_status is empty_stub / schema_mismatch /
partition_mismatch / no_data_files, and only after get_iceberg_health and
explicit confirmation; dry-run first. rebuild_iceberg_table requires
backfill_from as a z/ queue eid (z/ = start of the queue; a longer
z/… eid starts there). Aliases (start, start_of_queue, checkpoint,
now, all, durations) are refused. The hosted rebuild_iceberg_table
advertisement uses that same z/ schema. Enable windows stay on enable.
unreadable without that recovery is not a rebuild signal. status: "failed"
is an error; the warehouse error string is passed through as-is.
Studio Storage shows Iceberg table health as Iceberg off (Iceberg is not
enabled — turn it on first; do not rebuild), amber Warning (health could
not be resolved; this is not a rebuild signal), Healthy, or Needs
rebuild. The SQL editor and catalog browser query panel show these exact
notices and offer Rebuild only when the result names rebuild_iceberg or a
rebuild status (empty_stub, schema_mismatch, partition_mismatch,
no_data_files). They never infer Rebuild from DuckDB error text.
retryable: "Transient Iceberg metadata load. Retry the query. Do not rebuild."metadata_config_error: "Iceberg metadata configuration error. Fix the proxy URL or metadata location. Do not rebuild."unauthorized: "Iceberg metadata load was refused (unauthorized). The table itself was not checked. Do not rebuild."history_not_writtenis the query error "Event history for this product hasn't been written yet." The schema tree labels the entry "Not created yet" and does not load a starter query. There is no separate editor notice and no Rebuild control.
The SQL editor still shows an amber notice when health is unknown
(Iceberg metadata could not be resolved — table health is unknown, not healthy.) and does not offer Rebuild there. Rebuild still queues from Storage
when health is unknown and Iceberg is enabled.
Semantic search (row embeddings)
Iceberg data products can opt in to row embeddings. The table stores JSON
string columns lx__embedding and lx__embedding_hash. Default warehouse
views hide those columns (SELECT * EXCLUDE). Configure them on the product
as metadata.storage_indexing_preferences.row_embeddings:
fields— existing string-typed, non-PII schema fieldsdimensions—256,512, or1024(default256)mode—live,batch, orhybrid(defaulthybrid)nullclears the pref
loxtep_query → semantic_search embeds the query with Titan V2 and ranks
rows by cosine similarity. There is no SDK method and no CLI command.
Required: data_product_id, query. Optional: top_k (1–100, default 10)
and filters (equality only; string, number, or boolean values). Success
data is { items, coverage } — each item is a row plus score; coverage
may include embedding_rows_embedded and embedding_rows_total. The app's
Storage tab Row embeddings panel runs the same search with the default
top_k.
Known issue: Empty
coverageor apartialwarehouse result can look like full success. See issue 3325.Known issue:
semantic_searchfails with a knexUndefined binding data_product_iderror on some products. See issue 3322.
Search is refused when Iceberg is off, row embeddings are not enabled, or
organization privacy no_records_to_models is on.
Example (MCP contract). Unverified as a live happy path (see issue 3322). Do not treat this JSON as a transcript.
{
"operation": "semantic_search",
"data_product_id": "2dbc4415-e3a6-427c-99fe-b3a5234ff175",
"query": "late west-coast shipments",
"top_k": 10,
"filters": { "status": "open" }
}
Cross-Product Joins
The analytics engine enables joining across multiple data products in a single query, which is particularly useful for analytics that span domain boundaries:
SELECT c.customer_name, COUNT(o.order_id) as order_count, SUM(o.total_amount) as lifetime_value
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_name
ORDER BY lifetime_value DESC;
Cross-product joins respect the same access controls as individual table queries — you can only join products you have permission to read.
Streaming vs. Analytics
The two access modes serve different access patterns:
| Aspect | Streaming | Analytics (SQL) |
|---|---|---|
| Access pattern | Event-driven, push-based | Query-driven, pull-based |
| Latency | Real-time (sub-second) | Interactive (seconds) |
| Use case | Operational automation | Exploration and reporting |
| Data scope | Single event or batch | Full product history |
| Consumer type | Applications, workflows | Analysts, dashboards |
Both modes operate on the same underlying data — there is no separate copy or ETL required. Streaming operates on live event flow while analytics queries the accumulated state.
Integration with Data Products
Streaming and analytics integrate with data products at different points:
- Source products use streaming for ingestion (events flow inward) and expose analytics for internal querying.
- Consumer products use streaming for event stream delivery and expose analytics for SQL-based consumers.
- Workflows read from and write to streams during processing, and can trigger analytical queries as validation steps.
Performance and Scaling
Streaming Throughput
The streaming layer scales horizontally with partition-based parallelism. Each queue can handle thousands of events per second, and multiple partitions enable parallel consumer processing.
Query Performance
The analytics engine's columnar storage and vectorized execution provide fast analytical queries even on large datasets. For very large data products, query performance can be tuned via:
- Partitioning — data products can be partitioned by time or key for efficient range scans.
- Materialized views — pre-computed aggregations for common query patterns.
- Sampling — query a representative subset for exploratory analysis.