Skip to main content

Templated Abstract Polymorphic Database - A flexible object model library

Project description

tapdb (Templated Abstract Polymorphic Database)

An important mental shift is that templates describe shape, not business truth. Application repos own domain semantics and TAPDB stores the substrate that those semantics sit on.

tapdb-core is the repository for TAPDB, a reusable PostgreSQL-backed substrate for typed, versioned, auditable entities. The Python import package remains daylily_tapdb for now.

It is intentionally not a domain application. TAPDB provides the generic persistence and runtime mechanics that higher-level repos use to model their own business objects. Bloom is a motivating example of the kind of system TAPDB supports, but Bloom-specific workflow semantics do not belong in TAPDB itself.

At a high level TAPDB combines:

  • SQLAlchemy polymorphic models over a small, schema-stable core
  • template packs that define object shape and behavior
  • concrete instances created from those templates
  • lineage edges that describe relationships and history
  • audit, outbox, and inbox tables that preserve change and delivery state
  • explicit domain, application, and tenant scoping
flowchart TB
    App["Client application repo\n(Bloom or another domain app)"]
    CLI["tapdb CLI"]
    Lib["daylily_tapdb library"]
    DB["PostgreSQL\nschema + triggers + RLS"]
    Core["tapdb-core repository\nTAPDB core substrate\nTemplates / Instances / Lineage / Audit / Outbox / Inbox"]
    Domain["App-owned domain code\nTemplates, workflows, UI, integrations"]

    App --> Domain
    Domain --> CLI
    Domain --> Lib
    CLI --> Core
    Lib --> Core
    Core --> DB
    DB --> Core

Quickstart

The tapdb-core repo follows a CLI-first workflow. Start by activating the repo environment:

source ./activate

The canonical operational form for runtime commands is:

tapdb --config <path> ...

Smoke the installed CLI surface first:

tapdb --help
tapdb version
bash examples/readme/00_smoke.sh

For a fuller local bootstrap, use the namespaced config flow and then bring up the local runtime:

tapdb --config ~/.config/tapdb/<client-id>/<database-name>/tapdb-config.yaml \
  config init \
  --client-id <client-id> \
  --database-name <database-name> \
  --owner-repo-name <repo-name> \
  --domain-code <domain-code> \
  --domain-registry-path /abs/path/to/domain_code_registry.json \
  --prefix-ownership-registry-path /abs/path/to/prefix_ownership_registry.json \
  --engine-type local \
  --host localhost \
  --port 5533 \
  --ui-port 8911 \
  --user tapdb \
  --database tapdb_<client-id>_<database-name> \
  --schema-name tapdb_<client-id>_<database-name>

tapdb --config ~/.config/tapdb/<client-id>/<database-name>/tapdb-config.yaml \
  bootstrap local --no-gui

tapdb --config ~/.config/tapdb/<client-id>/<database-name>/tapdb-config.yaml \
  --json info

--json is a root-global flag in the CLI v2 contract, so it belongs before the subcommand name.

For a repo-local smoke path, this repo ships example registry fixtures under daylily_tapdb/etc/. Those files are suitable for single-repo local runs and for the README example scripts.

Meridian domain-code allocation is governed by the public lsmc-bio/meridian-registry repository. TAPDB consumes meridian-euid==0.4.7, which pins that public domain registry at 0.1.1 and exposes explicit domain-availability checks:

meridian-euid domain-check Q \
  --registry-index /abs/path/to/meridian-registry/registry/generated/domains.json

The TapDB domain_registry_path and prefix_ownership_registry_path values remain explicit local runtime inputs. They validate the domain and prefix claims used by a concrete TapDB deployment; they do not replace the public domain registry, and prefix assignment remains owned by domain holders rather than centralized in meridian-registry.

If optional workflow packs are present in the config, add --include-workflow to the bootstrap command. If you want the generated scripts rather than inline commands, use the companion examples under examples/readme/:

  • examples/readme/00_smoke.sh
  • examples/readme/10_bootstrap_local.sh
  • examples/readme/20_python_api.py

Mental Model

TAPDB’s core model is deliberately small:

  • template: a blueprint, stored as a generic_template row and usually seeded from JSON packs
  • instance: a concrete object, stored as a generic_instance row and created from a template
  • lineage: a directed relationship, stored as generic_instance_lineage
  • audit: immutable change history in audit_log
  • outbox: durable dispatch state for cross-service delivery
  • inbox: durable receipt state for inbound messages

The library surface is built around those concepts:

  • TemplateManager resolves template codes to seeded templates
  • InstanceFactory materializes instances from templates
  • lineage helpers traverse parent/child relationships
  • outbox helpers enqueue, claim, deliver, and record message attempts

The important mental shift is that template packs describe shape, not business truth. Application repos own domain semantics and TAPDB stores the substrate that those semantics sit on.

Identity And Scope

TAPDB uses multiple identity layers on purpose:

  • uid is the internal BIGINT primary key
  • euid is the external Meridian identifier used on labels, links, APIs, and human-facing references
  • domain_code scopes a row or identifier to a Meridian domain
  • issuer_app_code stores the persisted repo-owner token and is not part of the EUID string
  • tenant_id is the database tenancy scope and is separate from Meridian domain scoping

Do not infer business meaning from an EUID prefix. EUIDs are opaque by design. The string helps validation and transport; the real meaning lives in database lookup and application context.

Boundaries

TAPDB owns:

  • template seeding and validation
  • polymorphic persistence
  • lineage and graph traversal
  • audit and soft-delete behavior
  • outbox/inbox delivery state
  • CLI-managed runtime and database lifecycle

Application repos own:

  • domain semantics
  • domain template packs
  • workflow rules and business policy
  • UI and API affordances on top of TAPDB
  • integration-specific behavior

That boundary is the point of the project. TAPDB is the substrate, not the business system.

Docs

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

daylily_tapdb-8.0.5.tar.gz (515.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daylily_tapdb-8.0.5-py3-none-any.whl (285.9 kB view details)

Uploaded Python 3

File details

Details for the file daylily_tapdb-8.0.5.tar.gz.

File metadata

  • Download URL: daylily_tapdb-8.0.5.tar.gz
  • Upload date:
  • Size: 515.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for daylily_tapdb-8.0.5.tar.gz
Algorithm Hash digest
SHA256 15044257ad921195e0d6d4ff74b5430d44f29405dae00320476e81bd534f3ca7
MD5 c738c0b9e4d8a10de39eb4e88d155481
BLAKE2b-256 763c8b9147533cd6fedd21d845c94f4274ba07cfd7aea1490bfda9fa9edf61c5

See more details on using hashes here.

File details

Details for the file daylily_tapdb-8.0.5-py3-none-any.whl.

File metadata

  • Download URL: daylily_tapdb-8.0.5-py3-none-any.whl
  • Upload date:
  • Size: 285.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for daylily_tapdb-8.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d54d1bab68f4774e45b492f883535194c709488f0bbc2936026b16efe14d4ae6
MD5 01a807ee8f5fe6882e1dfbae03ff321a
BLAKE2b-256 96b2d3f87f75f45a95d4c42b0f9deee42cd1160b0fefdaabeac77aaa2ca3c581

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page