@polyglot-sql/sdk 0.3.10 → 0.4.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 +40 -0
- package/dist/cdn/polyglot.esm.js +1618 -1543
- package/dist/index.cjs +144 -32
- package/dist/index.d.cts +98 -8
- package/dist/index.d.ts +98 -8
- package/dist/index.js +159 -31
- package/dist/polyglot_sql_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -561,6 +561,43 @@ if (tables.success) {
|
|
|
561
561
|
}
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
+
## OpenLineage Output
|
|
565
|
+
|
|
566
|
+
Generate OpenLineage-compatible JSON payloads from SQL analysis. The SDK only
|
|
567
|
+
builds payloads; OpenLineage transport and client emission are intentionally out
|
|
568
|
+
of scope.
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
import {
|
|
572
|
+
openLineageColumnLineage,
|
|
573
|
+
openLineageJobEvent,
|
|
574
|
+
openLineageRunEvent,
|
|
575
|
+
} from '@polyglot-sql/sdk';
|
|
576
|
+
|
|
577
|
+
const options = {
|
|
578
|
+
producer: 'https://github.com/tobilg/polyglot',
|
|
579
|
+
datasetNamespace: 'postgres://warehouse',
|
|
580
|
+
outputDataset: {
|
|
581
|
+
namespace: 'postgres://warehouse',
|
|
582
|
+
name: 'analytics.revenue',
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
const columnLineage = openLineageColumnLineage(
|
|
587
|
+
'SELECT order_id, amount * 100 AS amount_cents FROM raw.orders',
|
|
588
|
+
options,
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
const runEvent = openLineageRunEvent('SELECT order_id FROM raw.orders', {
|
|
592
|
+
...options,
|
|
593
|
+
jobNamespace: 'polyglot',
|
|
594
|
+
jobName: 'orders_lineage',
|
|
595
|
+
eventTime: '2026-05-18T00:00:00Z',
|
|
596
|
+
runId: '3b452093-782c-4ef2-9c0c-aafe2aa6f34d',
|
|
597
|
+
eventType: 'COMPLETE',
|
|
598
|
+
});
|
|
599
|
+
```
|
|
600
|
+
|
|
564
601
|
## SQL Diff
|
|
565
602
|
|
|
566
603
|
Compare two SQL statements and get a list of edit operations using the ChangeDistiller algorithm.
|
|
@@ -640,6 +677,9 @@ const formattedSafe = pg.formatWithOptions('SELECT a,b FROM t', Dialect.Generic,
|
|
|
640
677
|
| `lineage(column, sql, dialect?, trimSelects?)` | Trace column lineage through a query |
|
|
641
678
|
| `lineageWithSchema(column, sql, schema, dialect?, trimSelects?)` | Trace lineage with schema-based qualification |
|
|
642
679
|
| `getSourceTables(column, sql, dialect?)` | Get source tables for a column |
|
|
680
|
+
| `openLineageColumnLineage(sql, options)` | Build an OpenLineage columnLineage facet and datasets |
|
|
681
|
+
| `openLineageJobEvent(sql, options)` | Build an OpenLineage JobEvent payload |
|
|
682
|
+
| `openLineageRunEvent(sql, options)` | Build an OpenLineage RunEvent payload |
|
|
643
683
|
| `diff(source, target, dialect?, options?)` | Diff two SQL statements |
|
|
644
684
|
| `hasChanges(edits)` | Check if diff has non-keep edits |
|
|
645
685
|
| `changesOnly(edits)` | Filter to only change edits |
|