Skip to content

Data Model

This page documents the current SQLite schema used by Inboxclaw.

Source of truth: src/database.py

Why This Matters

The data model is the contract between sources, the internal pipeline, and sinks. Understanding these tables helps with debugging delivery issues, writing custom tooling, and reasoning about reliability.

Entity Overview

TablePurpose
sourcesRegistered source instances from config.
source_kvPer-source key/value state storage.
sinksRegistered sink instances from config.
eventsDurable event store.
http_webhook_deliveriesWebhook delivery attempts and status per (event, sink).
http_pull_batchesHTTP Pull batch headers.
http_pull_batch_eventsMembership + processed flag for events in HTTP Pull batches.

Tables

sources

ColumnTypeNotes
idinteger PKInternal source ID.
namestring uniqueSource instance name (config key).
typestringSource implementation type.
cursorstring nullableLegacy cursor field (many sources now use source_kv).

source_kv

ColumnTypeNotes
idinteger PKRow ID.
source_idinteger FK -> sources.idOwning source.
keystringState key name.
valueJSONState value.
created_atdatetimeInsert timestamp (UTC).
updated_atdatetimeLast update timestamp (UTC).

Constraints:

  • Unique: (source_id, key)

sinks

ColumnTypeNotes
idinteger PKInternal sink ID.
namestring uniqueSink instance name (config key).
typestringSink implementation type.

events

ColumnTypeNotes
idinteger PKInternal event ID.
event_idstringSource-provided event identifier.
source_idinteger FK -> sources.idProducer source.
event_typestringDot-separated type (gmail.message_received, etc.).
entity_idstring nullableLogical entity reference for coalescing.
created_atdatetimePersist timestamp (UTC).
occurred_atdatetime nullableOriginal timestamp from source system.
dataJSON nullableEvent payload.
metaJSONTransient metadata (empty by default).

Constraints:

  • Unique: (source_id, event_id) (deduplication)

http_webhook_deliveries

ColumnTypeNotes
idinteger PKRow ID.
event_idinteger FK -> events.idDelivered event.
sink_idinteger FK -> sinks.idTarget webhook sink.
triesintegerNumber of attempts.
last_trydatetime nullableLast attempt timestamp.
created_atdatetimeRow creation timestamp (UTC).
deliveredbooleanDelivery success state.

Constraints:

  • Unique: (event_id, sink_id)

http_pull_batches

ColumnTypeNotes
idinteger PKBatch ID returned to clients.
sink_idinteger FK -> sinks.idOwning HTTP Pull sink.
created_atdatetimeBatch creation timestamp (UTC).

http_pull_batch_events

ColumnTypeNotes
idinteger PKRow ID.
batch_idinteger FK -> http_pull_batches.idParent batch.
event_idinteger FK -> events.idIncluded event.
processedbooleanWhether client confirmed this event.

Relationship Notes

  • One source produces many events.
  • One sink can have many webhook delivery rows and many HTTP pull batches.
  • One event can be linked to multiple sinks through delivery/batch tables.