Sources
Bind an App to one database or several, by connection name, and name each table so its source is plain.
sources: { lintel: { connection: 'lintel' } }, resources,See it in the sample (examples/apps/lintel/app.ts:52) (the resources are declared in resources.ts); Sample Apps says how to run Lintel.
Several sources, one of them the default:
sources: { ops: { connection: 'fieldops', default: true }, billing: { connection: 'billing' },},resources: { work_order: { access: 'write' }, 'billing.payment': {} },What you’ll see
Section titled “What you’ll see”- The default source’s tables named bare (
work_order) and every other source’s assource.table(billing.payment), in views, pages, paths and grants alike. - Connection URLs and credentials only in tablewalk.json;
authority.lockrecords each binding (source billing connection "billing").
When to use it, and when not
Section titled “When to use it, and when not”- Use one source for one database: a lone source is the default, and saying
default: trueon it is restated. - Use a source per schema on one PostgreSQL connection when the tables live in several schemas:
ops: { connection: 'main', schema: 'ops' }besidecatalog: { connection: 'main', schema: 'catalog' }. They are one database, so keys join and writes to both are one transaction. - Use sources on different connections only when the data truly lives apart: they share no joins or transactions, and a reference between them labels and links but never filters (relationships).
Options
Section titled “Options”| Key | What it does | Default | Status |
|---|---|---|---|
connection |
A connection named in tablewalk.json | required | Stable |
default |
Whose tables stay bare; at most one says true |
the lone source | Stable |
schema |
The one PostgreSQL schema it sees; not on SQLite | the connection’s | Stable |
resources |
'all' or a list: tables served without a {} block each |
blocks only | Stable |
physical (on a resource) |
The engine table it binds, 'archive.opportunity'; the only place an engine schema appears |
inferred | Stable |
{ "connections": [ { "name": "fieldops", "url": "${FIELDOPS_URL}", "writable": true }, { "name": "billing", "url": "postgres://reader@billing-db/billing" } ] }A table name two PostgreSQL schemas share is inferred as <schema>_<name> for each copy. Adding, removing or rebinding a source changes the App’s authority, so it needs a restart. Every key: App reference.
Common mistakes
Section titled “Common mistakes”[unknown-connection]→ the App names a connection tablewalk.json does not have; add it or fix the name.[restated]ondefault: truebeside no other source → delete it.- Two sources on one connection without a
schemaeach, or a schema the connection’s"schemas"leaves out → give each its own schema and list it.
Related
Section titled “Related”- Configure connections and services: tablewalk.json, URLs and
"writable". - Resources and fields: what each source’s tables may do.
- Tenant Apps: one source, its rows per tenant.
- Change your schema: migrations run per source’s schemas.