File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,41 @@ curl -X POST http://localhost:8000/api/v1/query \
112112}
113113```
114114
115+ ## Multi-Database Setup
116+
117+ Enable multi-db routing and register additional databases per tenant.
118+
119+ 1 ) Set environment flags:
120+ ``` env
121+ MULTIDB_ENABLED=true
122+ MULTIDB_REQUIRE_CONNECTION_TEST=true
123+ ```
124+
125+ 2 ) Register a database (schema registration primes cache):
126+ ``` bash
127+ curl -X POST http://localhost:8000/api/v1/schema/register \
128+ -H " Content-Type: application/json" \
129+ -d ' {
130+ "database_id": "analytics",
131+ "connection_string": "postgresql://user:pass@host:5432/analytics",
132+ "dialect": "postgresql"
133+ }'
134+ ```
135+
136+ 3 ) Use the ` database_id ` in queries:
137+ ``` bash
138+ curl -X POST http://localhost:8000/api/v1/query \
139+ -H " Content-Type: application/json" \
140+ -d ' {
141+ "query": "Show daily signups",
142+ "database_id": "analytics",
143+ "execute": false
144+ }'
145+ ```
146+
147+ Single-tenant fallback: set ` MULTIDB_ENABLED=false ` to route all requests to the
148+ configured ` DATABASE_URL ` .
149+
115150## Architecture
116151
117152```
You can’t perform that action at this time.
0 commit comments