@querypanel/node-sdk 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/index.cjs +525 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +183 -8
- package/dist/index.d.ts +183 -8
- package/dist/index.js +524 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,30 @@ await qp.syncSchema("analytics", {
|
|
|
126
126
|
|
|
127
127
|
Optionally limit the payload with `tables: ["orders"]`.
|
|
128
128
|
|
|
129
|
+
#### Large databases
|
|
130
|
+
|
|
131
|
+
`allowedTables` (and `tables`) accept `schema.*` to include every table in a schema on Postgres/Redshift, e.g. `["crm.*", "public.orders"]`. On ClickHouse and BigQuery the adapter is bound to one database/dataset, so `*` or `<database>.*` means "all tables".
|
|
132
|
+
|
|
133
|
+
Browse the catalog cheaply (no columns; not restricted by `allowedTables`) to build a table picker:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
await qp.listSchemas("warehouse"); // [{ schema: "crm", tableCount: 12 }, ...]
|
|
137
|
+
await qp.listTables("warehouse", { schema: "crm", search: "user", limit: 100 });
|
|
138
|
+
// [{ schema: "crm", name: "users", type: "table" }, ...] (default limit 500, max 5000)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For schemas too large for a single request, `syncSchemaInBatches` uploads tables in batches (≤ `maxBatchDocs` docs, default 1000, and ≤ `maxBatchBytes`, default 2 MB) and embeds them batch by batch:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
await qp.syncSchemaInBatches("warehouse", {
|
|
145
|
+
tenantId: "tenant_123",
|
|
146
|
+
maxColumns: 50_000, // throw SchemaTooLargeError before uploading if exceeded
|
|
147
|
+
onProgress: (e) => console.log(e.phase, e),
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
To spread the work across requests (e.g. serverless time limits), call `stageSchemaIngest` (introspect + upload + commit), then `embedSchemaIngestBatch(sessionId, i, ...)` for each batch, then `finalizeSchemaIngest(sessionId, ...)`.
|
|
152
|
+
|
|
129
153
|
### Custom system prompt (`systemPrompt`)
|
|
130
154
|
|
|
131
155
|
Pass `systemPrompt` on `ask()` to inject extra instructions for SQL generation. Use it when a **client** needs policies QueryPanel does not know about — retention windows, a max date range, excluded event types, and similar product rules. Look up that client’s config in your backend and pass it on every question.
|