@deepagents/text2sql 6.1.2 → 7.0.1
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 +16 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/lib/adapters/bigquery/index.js +87 -7
- package/dist/lib/adapters/bigquery/index.js.map +3 -3
- package/dist/lib/adapters/clickhouse/index.js +1 -1
- package/dist/lib/adapters/clickhouse/index.js.map +2 -2
- package/dist/lib/adapters/duckdb/duckdb-identifiers.d.ts +8 -0
- package/dist/lib/adapters/duckdb/duckdb-identifiers.d.ts.map +1 -0
- package/dist/lib/adapters/duckdb/duckdb.d.ts +40 -0
- package/dist/lib/adapters/duckdb/duckdb.d.ts.map +1 -0
- package/dist/lib/adapters/duckdb/duckdb.groundings.d.ts +58 -0
- package/dist/lib/adapters/duckdb/duckdb.groundings.d.ts.map +1 -0
- package/dist/lib/adapters/duckdb/duckdb.sql-policy.d.ts +8 -0
- package/dist/lib/adapters/duckdb/duckdb.sql-policy.d.ts.map +1 -0
- package/dist/lib/adapters/duckdb/index.d.ts +34 -0
- package/dist/lib/adapters/duckdb/index.d.ts.map +1 -0
- package/dist/lib/adapters/duckdb/index.js +1933 -0
- package/dist/lib/adapters/duckdb/index.js.map +7 -0
- package/dist/lib/adapters/mysql/index.js +87 -7
- package/dist/lib/adapters/mysql/index.js.map +3 -3
- package/dist/lib/adapters/parser-sql-policy.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/index.js +87 -7
- package/dist/lib/adapters/postgres/index.js.map +3 -3
- package/dist/lib/adapters/postgres/postgres-parser-workaround.d.ts +8 -0
- package/dist/lib/adapters/postgres/postgres-parser-workaround.d.ts.map +1 -0
- package/dist/lib/adapters/posthog/index.js +1 -1
- package/dist/lib/adapters/posthog/index.js.map +2 -2
- package/dist/lib/adapters/spreadsheet/index.js +87 -7
- package/dist/lib/adapters/spreadsheet/index.js.map +3 -3
- package/dist/lib/adapters/sqlite/index.js +87 -7
- package/dist/lib/adapters/sqlite/index.js.map +3 -3
- package/dist/lib/adapters/sqlserver/index.js +87 -7
- package/dist/lib/adapters/sqlserver/index.js.map +3 -3
- package/dist/lib/agents/question.agent.d.ts.map +1 -1
- package/dist/lib/synthesis/extractors/base-contextual-extractor.d.ts.map +1 -1
- package/dist/lib/synthesis/index.js.map +2 -2
- package/package.json +18 -19
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ AI-powered natural language to SQL. Ask questions in plain English, get executab
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Natural Language to SQL** - Convert questions to validated, executable queries
|
|
8
|
-
- **Multi-Database Support** - PostgreSQL, SQLite, SQL Server, MySQL/MariaDB, BigQuery, ClickHouse, and PostHog HogQL adapters
|
|
8
|
+
- **Multi-Database Support** - PostgreSQL, SQLite, DuckDB, SQL Server, MySQL/MariaDB, BigQuery, ClickHouse, and PostHog HogQL adapters
|
|
9
9
|
- **Schema-Aware** - Automatic introspection of tables, relationships, indexes, and constraints
|
|
10
10
|
- **Domain Knowledge** - Inject business terms, guardrails, and query patterns via fragments
|
|
11
11
|
- **Conversational** - Multi-turn conversations with context persistence
|
|
@@ -23,6 +23,7 @@ Install the database driver or client library that matches your adapter:
|
|
|
23
23
|
npm install pg # PostgreSQL
|
|
24
24
|
npm install mssql # SQL Server
|
|
25
25
|
npm install mysql2 # MySQL / MariaDB
|
|
26
|
+
npm install @duckdb/node-api # DuckDB
|
|
26
27
|
npm install @google-cloud/bigquery # BigQuery
|
|
27
28
|
npm install @clickhouse/client # ClickHouse, or use your preferred client
|
|
28
29
|
# PostHog uses native fetch and needs no additional client package
|
|
@@ -297,9 +298,22 @@ withhold extension, file, remote-query, and routine execution capabilities; and
|
|
|
297
298
|
configure dialect-appropriate statement timeouts, byte/result limits, and
|
|
298
299
|
compute/memory limits.
|
|
299
300
|
|
|
301
|
+
The DuckDB adapter uses DuckDB's native JSON AST instead of the shared SQL
|
|
302
|
+
parser, so DuckDB-specific syntax is analyzed in its real grammar. It resolves
|
|
303
|
+
every referenced relation to a quoted `catalog.schema.table`, rejects writes,
|
|
304
|
+
multi-statement batches, side-effecting or user-defined functions and macros,
|
|
305
|
+
and arbitrary table functions, then compares those relations with the tables
|
|
306
|
+
and views produced by grounding. Production DuckDB connections must still be
|
|
307
|
+
read-only, disable external access and automatic/community extension loading,
|
|
308
|
+
set resource limits, and lock configuration after setup.
|
|
309
|
+
|
|
300
310
|
The PostHog adapter does not pass HogQL through the local SQL parser. It asks
|
|
301
311
|
PostHog to parse each query with `HogQLMetadata`, checks the returned base-table
|
|
302
312
|
names against grounded schema, and only then sends a `HogQLQuery` for execution.
|
|
313
|
+
Direct `adapter.execute(sql, values)` calls forward named HogQL values unchanged
|
|
314
|
+
after validation, which is useful for application-owned filters added outside
|
|
315
|
+
the model loop. Shell-escaped dollar-prefixed PostHog properties such as
|
|
316
|
+
`properties['\$device_type']` are decoded before validation and execution.
|
|
303
317
|
|
|
304
318
|
## Fragments
|
|
305
319
|
|
|
@@ -543,6 +557,7 @@ Full documentation available at [januarylabs.github.io/deepagents](https://janua
|
|
|
543
557
|
- [Grounding](https://januarylabs.github.io/deepagents/docs/text2sql/grounding)
|
|
544
558
|
- [PostgreSQL](https://januarylabs.github.io/deepagents/docs/text2sql/postgresql)
|
|
545
559
|
- [SQLite](https://januarylabs.github.io/deepagents/docs/text2sql/sqlite)
|
|
560
|
+
- [DuckDB](https://januarylabs.github.io/deepagents/docs/text2sql/duckdb)
|
|
546
561
|
- [SQL Server](https://januarylabs.github.io/deepagents/docs/text2sql/sqlserver)
|
|
547
562
|
- [MySQL / MariaDB](https://januarylabs.github.io/deepagents/docs/text2sql/mysql)
|
|
548
563
|
- [BigQuery](https://januarylabs.github.io/deepagents/docs/text2sql/bigquery)
|
package/dist/index.js
CHANGED
|
@@ -418,7 +418,7 @@ var Adapter = class {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
#decodeShellEscapes(sql) {
|
|
421
|
-
return sql.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\([()
|
|
421
|
+
return sql.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\([().*$])/g, "$1").replace(/\\(?=$)/gm, "");
|
|
422
422
|
}
|
|
423
423
|
#cachedAllowedEntities = null;
|
|
424
424
|
async #resolveScope() {
|