@polyglot-sql/sdk 0.4.3 → 0.5.0
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 +22 -1
- package/dist/cdn/polyglot.esm.js +1535 -1508
- package/dist/index.cjs +123 -64
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +143 -68
- package/dist/index.node.js +121 -64
- package/dist/manual.js +139 -68
- package/dist/polyglot_sql.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,22 @@ const result = transpile(
|
|
|
25
25
|
console.log(result.sql[0]); // SELECT COALESCE(a, b) FROM t
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Use `unsupportedLevel: 'raise'` when you want transpilation to fail instead of
|
|
29
|
+
silently preserving known unsupported target-dialect constructs.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const strict = transpile(
|
|
33
|
+
'SELECT ARRAY_AGG(x) FROM t',
|
|
34
|
+
Dialect.PostgreSQL,
|
|
35
|
+
Dialect.Fabric,
|
|
36
|
+
{ unsupportedLevel: 'raise' },
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (!strict.success) {
|
|
40
|
+
console.error(strict.error);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
28
44
|
### Parse + Generate
|
|
29
45
|
|
|
30
46
|
```typescript
|
|
@@ -561,6 +577,11 @@ if (tables.success) {
|
|
|
561
577
|
}
|
|
562
578
|
```
|
|
563
579
|
|
|
580
|
+
Lineage nodes include `source_kind` and optional `source_alias` metadata. Table
|
|
581
|
+
columns are marked as `table`, CTEs as `cte`, derived queries as
|
|
582
|
+
`derived_table`, and virtual sources such as BigQuery `UNNEST(...) AS alias`
|
|
583
|
+
are marked as `virtual`.
|
|
584
|
+
|
|
564
585
|
## OpenLineage Output
|
|
565
586
|
|
|
566
587
|
Generate OpenLineage-compatible JSON payloads from SQL analysis. The SDK only
|
|
@@ -659,7 +680,7 @@ const formattedSafe = pg.formatWithOptions('SELECT a,b FROM t', Dialect.Generic,
|
|
|
659
680
|
|
|
660
681
|
| Function | Description |
|
|
661
682
|
|----------|-------------|
|
|
662
|
-
| `transpile(sql, read, write)` | Transpile SQL between dialects |
|
|
683
|
+
| `transpile(sql, read, write, options?)` | Transpile SQL between dialects |
|
|
663
684
|
| `parse(sql, dialect?)` | Parse SQL into AST |
|
|
664
685
|
| `generate(ast, dialect?)` | Generate SQL from AST |
|
|
665
686
|
| `format(sql, dialect?)` | Pretty-print SQL |
|