Skip to main content
Two related surfaces, both about how a runbook reads and writes data inside Ntropii Tenant. They share a page because they’re easy to confuse.

Install

Both are bundled with the workflow extra.

ntro.data — direct platform access

ntro.data.get_data_plane() returns a connection to the tenant’s data platform under its bound credentials (or to its managed Postgres if that’s the strategy). It’s an async object with methods that mirror the underlying driver — fetchrow, fetch, execute for Postgres / asyncpg; equivalent SQL surfaces for Snowflake and Microsoft Fabric.

Canonical example

Lifted from nav-monthly — the runbook reads from the tenant’s data plane to check that a starting trial balance is in place:
Two things to notice:
  • get_data_plane(tenant_slug) scopes the connection to the tenant. The credentials are resolved from the tenant’s data platform binding — you never see the secret in the runbook.
  • asyncpg-style positional parameters for Postgres. Driver dialect varies for Snowflake / Microsoft Fabric; the SDK normalises where it can.

What lives here

ntro.data is the right tool for things that belong to the customer’s warehouse: their COA, their journal entries, their submitted documents, their tenant-specific tables. The runbook reads from and writes to the same place the customer’s accountants and their other systems read from and write to.

ntro.capabilities.storage — runbook artifacts

Different surface, different purpose. storage is for runbook-internal artifacts — audit trails, intermediate caches, structured state the runbook wants to persist but isn’t part of the customer’s authoritative warehouse.

Canonical example

Lifted from document-ingest — after a document’s extracted payload is committed to the tenant data plane, the runbook also writes a copy to storage as a cheap audit trail:
The data plane is the source of truth; storage is the audit copy. Two writes, two distinct purposes.

Choosing between them

A common pattern: read raw bytes from ntro.data, parse + extract, write the typed result to ntro.data (authoritative) AND write a JSON copy to storage (audit). That’s exactly what document-ingest does.

Collect files

Often pairs with ntro.data — read bytes, parse them.

Tenant architecture

Why the data plane is the customer’s, and Ntropii Tenant accesses it under the customer’s credentials.