| Surface | When to use it |
|---|---|
ntro.data.get_data_plane() | Direct access to the tenant’s data platform — managed Postgres, Snowflake, or Microsoft Fabric. Raw SQL, structured queries, tenant-specific schema. |
ntro.capabilities.storage | Runbook-managed files and tables. JSON-backed for now; not coupled to a specific warehouse. Use for audit-trail artifacts, intermediate state, anything the runbook itself wants to persist. |
Install
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 fromnav-monthly — the runbook reads from the tenant’s data plane to check that a starting trial balance is in place:
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 fromdocument-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:
Choosing between them
| You want to… | Use |
|---|---|
| Read/write the customer’s authoritative tables | ntro.data |
| Run a complex SQL aggregation against the warehouse | ntro.data |
| Persist an intermediate result the runbook produced | storage |
| Keep an audit trail of what the runbook did | storage |
| Cache a parsed file so a re-run doesn’t reparse | storage |
Look up a document by document_ref (the canonical PoC pattern) | ntro.data (SELECT data_bytes FROM submitted_documents) |
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.
Related
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.