map-conform 0.1.0__py3-none-any.whl

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.
Files changed (79) hide show
  1. map_conform/__init__.py +5 -0
  2. map_conform/__main__.py +7 -0
  3. map_conform/batch/__init__.py +1 -0
  4. map_conform/batch/arrow.py +80 -0
  5. map_conform/batch/columnar.py +125 -0
  6. map_conform/batch/engine.py +191 -0
  7. map_conform/batch/files.py +207 -0
  8. map_conform/cli.py +460 -0
  9. map_conform/doctor.py +178 -0
  10. map_conform/errors.py +107 -0
  11. map_conform/expr/__init__.py +6 -0
  12. map_conform/expr/compiler.py +562 -0
  13. map_conform/expr/functions.py +542 -0
  14. map_conform/expr/sandbox.py +333 -0
  15. map_conform/expr/sdk.py +116 -0
  16. map_conform/map-conform-spec.schema.json +1204 -0
  17. map_conform/mapper.py +355 -0
  18. map_conform/metadata.py +73 -0
  19. map_conform/metrics.py +62 -0
  20. map_conform/naming/__init__.py +1 -0
  21. map_conform/naming/ascii-table.json +980 -0
  22. map_conform/naming/conform.py +262 -0
  23. map_conform/naming/flatten.py +148 -0
  24. map_conform/naming/nested.py +117 -0
  25. map_conform/naming/reserved/ansi.txt +369 -0
  26. map_conform/naming/reserved/duckdb.txt +114 -0
  27. map_conform/naming/reserved/postgres.txt +105 -0
  28. map_conform/naming/reserved/snowflake.txt +90 -0
  29. map_conform/naming/reserved.py +34 -0
  30. map_conform/naming/shape.py +96 -0
  31. map_conform/naming/streams.py +76 -0
  32. map_conform/naming/translit.py +170 -0
  33. map_conform/plan/__init__.py +1 -0
  34. map_conform/plan/chain.py +667 -0
  35. map_conform/plan/compile.py +551 -0
  36. map_conform/plan/lower.py +281 -0
  37. map_conform/plan/ops.py +336 -0
  38. map_conform/plan/row.py +212 -0
  39. map_conform/plan/vector.py +71 -0
  40. map_conform/rejects.py +92 -0
  41. map_conform/settings.py +157 -0
  42. map_conform/spec/__init__.py +1 -0
  43. map_conform/spec/_struct.py +483 -0
  44. map_conform/spec/bridge.py +109 -0
  45. map_conform/spec/check.py +380 -0
  46. map_conform/spec/errors.py +22 -0
  47. map_conform/spec/importer.py +87 -0
  48. map_conform/spec/jsonschema.py +54 -0
  49. map_conform/spec/load.py +357 -0
  50. map_conform/spec/model.py +473 -0
  51. map_conform/spec/reference.py +179 -0
  52. map_conform/spec/steps.py +297 -0
  53. map_conform/spec/stream_maps.py +233 -0
  54. map_conform/spec/zamboni.py +99 -0
  55. map_conform/transforms/__init__.py +1 -0
  56. map_conform/transforms/builtins.py +63 -0
  57. map_conform/transforms/casts.py +310 -0
  58. map_conform/transforms/fake.py +150 -0
  59. map_conform/transforms/nested.py +111 -0
  60. map_conform/transforms/numeric.py +318 -0
  61. map_conform/transforms/polars_vector.py +151 -0
  62. map_conform/transforms/privacy.py +220 -0
  63. map_conform/transforms/registry.py +116 -0
  64. map_conform/transforms/temporal.py +410 -0
  65. map_conform/transforms/text.py +249 -0
  66. map_conform/transforms/vector.py +386 -0
  67. map_conform/types/__init__.py +1 -0
  68. map_conform/types/canonical.py +255 -0
  69. map_conform/types/from_jsonschema.py +177 -0
  70. map_conform/types/jsontext.py +63 -0
  71. map_conform/types/to_arrow.py +52 -0
  72. map_conform/types/to_jsonschema.py +65 -0
  73. map_conform/types/wire.py +53 -0
  74. map_conform/udfs.py +327 -0
  75. map_conform-0.1.0.dist-info/METADATA +157 -0
  76. map_conform-0.1.0.dist-info/RECORD +79 -0
  77. map_conform-0.1.0.dist-info/WHEEL +4 -0
  78. map_conform-0.1.0.dist-info/entry_points.txt +2 -0
  79. map_conform-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1204 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/paulcaron16k/map-conform/main/map_conform/map-conform-spec.schema.json",
4
+ "title": "map-conform spec (version 1)",
5
+ "$ref": "#/$defs/Spec",
6
+ "$defs": {
7
+ "BooleanDefaults": {
8
+ "description": "Words that cast to booleans (case-insensitive unless the cast says otherwise).",
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "true_values": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "string"
16
+ },
17
+ "description": "Strings that mean true.",
18
+ "default": [
19
+ "true",
20
+ "t",
21
+ "yes",
22
+ "y",
23
+ "1",
24
+ "on"
25
+ ]
26
+ },
27
+ "false_values": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "string"
31
+ },
32
+ "description": "Strings that mean false.",
33
+ "default": [
34
+ "false",
35
+ "f",
36
+ "no",
37
+ "n",
38
+ "0",
39
+ "off"
40
+ ]
41
+ }
42
+ }
43
+ },
44
+ "ColumnSpec": {
45
+ "description": "One output column. Unset keys inherit from the stream's defaults or the tap SCHEMA.",
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "name": {
50
+ "type": [
51
+ "string",
52
+ "null"
53
+ ],
54
+ "description": "Output name. It is checked, never silently conformed.",
55
+ "default": null
56
+ },
57
+ "type": {
58
+ "type": [
59
+ "string",
60
+ "null"
61
+ ],
62
+ "description": "Declared CType, e.g. int64, decimal(18,2), timestamptz. From the tap SCHEMA if absent.",
63
+ "default": null
64
+ },
65
+ "nullable": {
66
+ "type": "boolean",
67
+ "description": "If false, a null is an error under on_error.",
68
+ "default": true
69
+ },
70
+ "source": {
71
+ "type": [
72
+ "string",
73
+ "array",
74
+ "null"
75
+ ],
76
+ "items": {
77
+ "type": "string"
78
+ },
79
+ "description": "Source column(s) if not the key; a list coalesces in order.",
80
+ "default": null
81
+ },
82
+ "expr": {
83
+ "type": [
84
+ "string",
85
+ "null"
86
+ ],
87
+ "description": "Derived value. Without source, it creates a new column.",
88
+ "default": null
89
+ },
90
+ "default": {
91
+ "description": "Used when the value is missing or null after transforms.",
92
+ "default": null
93
+ },
94
+ "transform": {
95
+ "anyOf": [
96
+ {
97
+ "anyOf": [
98
+ {
99
+ "$ref": "#/$defs/Step"
100
+ },
101
+ {
102
+ "type": "array",
103
+ "items": {
104
+ "$ref": "#/$defs/Step"
105
+ },
106
+ "minItems": 1
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "type": "null"
112
+ }
113
+ ],
114
+ "description": "Steps run before the implicit cast.",
115
+ "default": null
116
+ },
117
+ "parse": {
118
+ "type": [
119
+ "object",
120
+ "null"
121
+ ],
122
+ "additionalProperties": {},
123
+ "description": "Keyword arguments for the implicit cast, e.g. {formats: [...], tz: ...}.",
124
+ "default": null
125
+ },
126
+ "true_values": {
127
+ "type": [
128
+ "array",
129
+ "null"
130
+ ],
131
+ "items": {
132
+ "type": "string"
133
+ },
134
+ "description": "Overrides boolean.true_values.",
135
+ "default": null
136
+ },
137
+ "false_values": {
138
+ "type": [
139
+ "array",
140
+ "null"
141
+ ],
142
+ "items": {
143
+ "type": "string"
144
+ },
145
+ "description": "Overrides boolean.false_values.",
146
+ "default": null
147
+ },
148
+ "null_tokens": {
149
+ "type": [
150
+ "array",
151
+ "null"
152
+ ],
153
+ "items": {
154
+ "type": "string"
155
+ },
156
+ "description": "Overrides values.null_tokens.",
157
+ "default": null
158
+ },
159
+ "trim": {
160
+ "type": [
161
+ "boolean",
162
+ "null"
163
+ ],
164
+ "description": "Overrides values.trim.",
165
+ "default": null
166
+ },
167
+ "on_error": {
168
+ "enum": [
169
+ "raise",
170
+ "null",
171
+ "keep",
172
+ "reject",
173
+ null
174
+ ],
175
+ "description": "Overrides on_error.",
176
+ "default": null
177
+ },
178
+ "max_length": {
179
+ "type": [
180
+ "integer",
181
+ "null"
182
+ ],
183
+ "description": "Longest string allowed.",
184
+ "default": null
185
+ },
186
+ "on_overflow": {
187
+ "enum": [
188
+ "truncate",
189
+ "error"
190
+ ],
191
+ "description": "What a string longer than max_length does.",
192
+ "default": "error"
193
+ },
194
+ "enum": {
195
+ "type": [
196
+ "array",
197
+ "null"
198
+ ],
199
+ "items": {},
200
+ "description": "Allowed values, checked after the cast.",
201
+ "default": null
202
+ },
203
+ "drop": {
204
+ "type": "boolean",
205
+ "description": "Remove the column. Dropping a key property is an error.",
206
+ "default": false
207
+ },
208
+ "doc": {
209
+ "type": [
210
+ "string",
211
+ "null"
212
+ ],
213
+ "description": "Copied to the SCHEMA description.",
214
+ "default": null
215
+ },
216
+ "sql_type": {
217
+ "type": [
218
+ "string",
219
+ "null"
220
+ ],
221
+ "description": "Overrides the emitted x-sql-datatype hint.",
222
+ "default": null
223
+ },
224
+ "when": {
225
+ "type": [
226
+ "string",
227
+ "null"
228
+ ],
229
+ "description": "Apply the chain only to rows where this is truthy; sees conformed names.",
230
+ "default": null
231
+ },
232
+ "fields": {
233
+ "type": [
234
+ "object",
235
+ "null"
236
+ ],
237
+ "additionalProperties": {
238
+ "$ref": "#/$defs/FieldSpec"
239
+ },
240
+ "description": "Transforms on nested members of struct and json columns, by dotted path.",
241
+ "default": null
242
+ },
243
+ "shape": {
244
+ "type": [
245
+ "object",
246
+ "null"
247
+ ],
248
+ "additionalProperties": {},
249
+ "description": "JSON Schema of the column's object or array value, inline or as a path to a .json file (relative to the spec file). It alone decides the column's type, or its flattened columns; members it does not declare are dropped, counted and logged; a member's default (null, {}, []) is used when it is missing or empty.",
250
+ "default": null
251
+ },
252
+ "flatten": {
253
+ "type": [
254
+ "boolean",
255
+ "null"
256
+ ],
257
+ "description": "Flatten this column into parent__child columns (from its shape when it has one). Unset: follow nested: flatten.",
258
+ "default": null
259
+ },
260
+ "engine": {
261
+ "enum": [
262
+ "arrow",
263
+ "polars",
264
+ null
265
+ ],
266
+ "description": "Overrides engine for this column.",
267
+ "default": null
268
+ },
269
+ "infer_type": {
270
+ "enum": [
271
+ "sdk",
272
+ null
273
+ ],
274
+ "description": "Without type: infer it from expr as the Singer SDK mapper does (int(...) is an integer, and so on). Set by stream_maps translation; declaring type is clearer.",
275
+ "default": null
276
+ }
277
+ }
278
+ },
279
+ "Defaults": {
280
+ "description": "Settings inherited by every stream. A stream may override any of them.",
281
+ "type": "object",
282
+ "additionalProperties": false,
283
+ "properties": {
284
+ "naming": {
285
+ "anyOf": [
286
+ {
287
+ "$ref": "#/$defs/NamingDefaults"
288
+ },
289
+ {
290
+ "const": "sdk",
291
+ "description": "Short for {preset: sdk}."
292
+ }
293
+ ],
294
+ "description": "Column naming.",
295
+ "default": {
296
+ "preset": "map-conform",
297
+ "case": "snake",
298
+ "split_camel": true,
299
+ "ascii": "transliterate",
300
+ "replace_invalid": "_",
301
+ "collapse": true,
302
+ "leading_digit": "prefix",
303
+ "max_length": 63,
304
+ "truncate": "hash",
305
+ "reserved_words": "suffix",
306
+ "reserved_dialects": [
307
+ "postgres",
308
+ "duckdb",
309
+ "snowflake"
310
+ ],
311
+ "on_collision": "error",
312
+ "nested": true
313
+ }
314
+ },
315
+ "stream": {
316
+ "$ref": "#/$defs/StreamNaming",
317
+ "description": "Stream naming.",
318
+ "default": {
319
+ "name": "conform",
320
+ "prefix": "",
321
+ "split": null
322
+ }
323
+ },
324
+ "values": {
325
+ "$ref": "#/$defs/ValuesDefaults",
326
+ "description": "Value cleanup.",
327
+ "default": {
328
+ "trim": true,
329
+ "null_tokens": [
330
+ "",
331
+ "NULL",
332
+ "null",
333
+ "N/A",
334
+ "n/a",
335
+ "#N/A",
336
+ "NaN",
337
+ "-"
338
+ ],
339
+ "null_tokens_case_sensitive": false,
340
+ "empty_string_for_string": "keep"
341
+ }
342
+ },
343
+ "timestamp": {
344
+ "$ref": "#/$defs/TimestampDefaults",
345
+ "description": "Temporal casts.",
346
+ "default": {
347
+ "assume_tz": "UTC",
348
+ "output_precision": "us",
349
+ "formats": [
350
+ "iso"
351
+ ]
352
+ }
353
+ },
354
+ "boolean": {
355
+ "$ref": "#/$defs/BooleanDefaults",
356
+ "description": "Boolean casts.",
357
+ "default": {
358
+ "true_values": [
359
+ "true",
360
+ "t",
361
+ "yes",
362
+ "y",
363
+ "1",
364
+ "on"
365
+ ],
366
+ "false_values": [
367
+ "false",
368
+ "f",
369
+ "no",
370
+ "n",
371
+ "0",
372
+ "off"
373
+ ]
374
+ }
375
+ },
376
+ "on_error": {
377
+ "enum": [
378
+ "raise",
379
+ "null",
380
+ "keep",
381
+ "reject"
382
+ ],
383
+ "description": "What a failed cast or transform does: raise, null, keep the raw value, or reject the row to the dead-letter sink.",
384
+ "default": "raise"
385
+ },
386
+ "add_record_metadata": {
387
+ "type": "boolean",
388
+ "description": "Add the seven Singer SDK _sdc_* columns to SCHEMA, RECORD and BATCH output, as SDK targets do with their setting of the same name.",
389
+ "default": false
390
+ },
391
+ "undeclared": {
392
+ "enum": [
393
+ "conform",
394
+ "drop",
395
+ "error"
396
+ ],
397
+ "description": "Columns the spec does not mention: conform them from the tap SCHEMA, drop them, or fail.",
398
+ "default": "conform"
399
+ },
400
+ "nested": {
401
+ "enum": [
402
+ "json",
403
+ "flatten",
404
+ "keep"
405
+ ],
406
+ "description": "Undeclared object and array columns: JSON text, flattened, or typed struct/list.",
407
+ "default": "json"
408
+ },
409
+ "flatten": {
410
+ "$ref": "#/$defs/FlattenDefaults",
411
+ "description": "Flattening settings.",
412
+ "default": {
413
+ "separator": "__",
414
+ "max_depth": 1,
415
+ "max_key_length": 255
416
+ }
417
+ },
418
+ "faker": {
419
+ "$ref": "#/$defs/FakerDefaults",
420
+ "description": "Fake data settings.",
421
+ "default": {
422
+ "seed": null,
423
+ "locale": null
424
+ }
425
+ },
426
+ "engine": {
427
+ "enum": [
428
+ "arrow",
429
+ "polars"
430
+ ],
431
+ "description": "Vectorised BATCH engine: Arrow, or polars (the polars extra), which also vectorises regular expressions and strptime date formats.",
432
+ "default": "arrow"
433
+ },
434
+ "max_reject_rate": {
435
+ "type": [
436
+ "number",
437
+ "null"
438
+ ],
439
+ "description": "Fail the run when more than this fraction of a stream's rows is rejected (0-1).",
440
+ "default": null
441
+ },
442
+ "max_null_rate": {
443
+ "type": [
444
+ "number",
445
+ "null"
446
+ ],
447
+ "description": "Fail the run when on_error: null nulls values in more than this fraction of a stream's rows (0-1).",
448
+ "default": null
449
+ }
450
+ }
451
+ },
452
+ "ExprRef": {
453
+ "description": "A value computed by an expression.",
454
+ "type": "object",
455
+ "additionalProperties": false,
456
+ "properties": {
457
+ "expr": {
458
+ "type": "string",
459
+ "description": "The expression."
460
+ }
461
+ },
462
+ "required": [
463
+ "expr"
464
+ ]
465
+ },
466
+ "FakerDefaults": {
467
+ "description": "Settings for the fake builtin (needs the faker extra).",
468
+ "type": "object",
469
+ "additionalProperties": false,
470
+ "properties": {
471
+ "seed": {
472
+ "type": [
473
+ "integer",
474
+ "null"
475
+ ],
476
+ "description": "Seed for reproducible fake values.",
477
+ "default": null
478
+ },
479
+ "locale": {
480
+ "type": [
481
+ "string",
482
+ "array",
483
+ "null"
484
+ ],
485
+ "items": {
486
+ "type": "string"
487
+ },
488
+ "description": "Faker locale or locales.",
489
+ "default": null
490
+ }
491
+ }
492
+ },
493
+ "FieldSpec": {
494
+ "description": "Transforms on a nested member of a struct or json column, by dotted path.",
495
+ "type": "object",
496
+ "additionalProperties": false,
497
+ "properties": {
498
+ "transform": {
499
+ "anyOf": [
500
+ {
501
+ "anyOf": [
502
+ {
503
+ "$ref": "#/$defs/Step"
504
+ },
505
+ {
506
+ "type": "array",
507
+ "items": {
508
+ "$ref": "#/$defs/Step"
509
+ },
510
+ "minItems": 1
511
+ }
512
+ ]
513
+ },
514
+ {
515
+ "type": "null"
516
+ }
517
+ ],
518
+ "description": "Steps applied to the member.",
519
+ "default": null
520
+ },
521
+ "when": {
522
+ "type": [
523
+ "string",
524
+ "null"
525
+ ],
526
+ "description": "Apply only where this expression is truthy.",
527
+ "default": null
528
+ },
529
+ "drop": {
530
+ "type": "boolean",
531
+ "description": "Remove the member.",
532
+ "default": false
533
+ }
534
+ }
535
+ },
536
+ "FlattenDefaults": {
537
+ "description": "Singer SDK flattening semantics, for nested: flatten.",
538
+ "type": "object",
539
+ "additionalProperties": false,
540
+ "properties": {
541
+ "separator": {
542
+ "type": "string",
543
+ "description": "Joins parent and child keys.",
544
+ "default": "__"
545
+ },
546
+ "max_depth": {
547
+ "type": "integer",
548
+ "description": "Levels of nesting to flatten.",
549
+ "default": 1
550
+ },
551
+ "max_key_length": {
552
+ "type": "integer",
553
+ "description": "Longest flattened key.",
554
+ "default": 255
555
+ }
556
+ }
557
+ },
558
+ "NamingDefaults": {
559
+ "description": "How column names are conformed. ``naming: sdk`` is short for ``{preset: sdk}``.",
560
+ "type": "object",
561
+ "additionalProperties": false,
562
+ "properties": {
563
+ "preset": {
564
+ "enum": [
565
+ "map-conform",
566
+ "sdk"
567
+ ],
568
+ "description": "sdk reproduces the Singer SDK's SQL conform_name byte for byte (for migrations); only on_collision applies then.",
569
+ "default": "map-conform"
570
+ },
571
+ "case": {
572
+ "enum": [
573
+ "snake",
574
+ "lower",
575
+ "upper",
576
+ "preserve"
577
+ ],
578
+ "description": "snake splits camelCase and lowercases; lower and upper only change case.",
579
+ "default": "snake"
580
+ },
581
+ "split_camel": {
582
+ "type": "boolean",
583
+ "description": "customerID -> customer_id; HTTPServer -> http_server.",
584
+ "default": true
585
+ },
586
+ "ascii": {
587
+ "enum": [
588
+ "transliterate",
589
+ "strip",
590
+ "keep"
591
+ ],
592
+ "description": "transliterate with the bundled table (ADR-0012), strip non-ASCII, or keep it.",
593
+ "default": "transliterate"
594
+ },
595
+ "replace_invalid": {
596
+ "type": "string",
597
+ "description": "Replacement for characters outside [a-z0-9_] after casing.",
598
+ "default": "_"
599
+ },
600
+ "collapse": {
601
+ "type": "boolean",
602
+ "description": "Collapse runs of '_' and trim it from both ends.",
603
+ "default": true
604
+ },
605
+ "leading_digit": {
606
+ "enum": [
607
+ "prefix",
608
+ "letter",
609
+ "error"
610
+ ],
611
+ "description": "prefix '_', letter (SDK style: 0 -> a), or error.",
612
+ "default": "prefix"
613
+ },
614
+ "max_length": {
615
+ "type": "integer",
616
+ "description": "Longer names are truncated (see truncate). At least 8, room for a hash suffix.",
617
+ "default": 63
618
+ },
619
+ "truncate": {
620
+ "enum": [
621
+ "hash",
622
+ "error"
623
+ ],
624
+ "description": "hash keeps the head plus '_' and 6 hex digits of a hash of the full name.",
625
+ "default": "hash"
626
+ },
627
+ "reserved_words": {
628
+ "enum": [
629
+ "suffix",
630
+ "prefix",
631
+ "error",
632
+ "ignore"
633
+ ],
634
+ "description": "What to do with a reserved word: suffix '_', prefix '_', error or ignore.",
635
+ "default": "suffix"
636
+ },
637
+ "reserved_dialects": {
638
+ "type": "array",
639
+ "items": {
640
+ "enum": [
641
+ "postgres",
642
+ "duckdb",
643
+ "snowflake",
644
+ "ansi"
645
+ ]
646
+ },
647
+ "description": "Reserved-word lists to union. ansi (SQL:2016) is opt-in: it reserves common column names such as date, year and value.",
648
+ "default": [
649
+ "postgres",
650
+ "duckdb",
651
+ "snowflake"
652
+ ]
653
+ },
654
+ "on_collision": {
655
+ "enum": [
656
+ "error",
657
+ "suffix"
658
+ ],
659
+ "description": "Two names conforming to the same output: error, or add _2, _3, ...",
660
+ "default": "error"
661
+ },
662
+ "nested": {
663
+ "type": "boolean",
664
+ "description": "Also conform the member names of struct columns.",
665
+ "default": true
666
+ }
667
+ }
668
+ },
669
+ "Spec": {
670
+ "description": "A conform spec file, version 1.",
671
+ "type": "object",
672
+ "additionalProperties": false,
673
+ "properties": {
674
+ "version": {
675
+ "enum": [
676
+ 1
677
+ ],
678
+ "description": "The spec version."
679
+ },
680
+ "defaults": {
681
+ "$ref": "#/$defs/Defaults",
682
+ "description": "Inherited by every stream.",
683
+ "default": {
684
+ "naming": {
685
+ "preset": "map-conform",
686
+ "case": "snake",
687
+ "split_camel": true,
688
+ "ascii": "transliterate",
689
+ "replace_invalid": "_",
690
+ "collapse": true,
691
+ "leading_digit": "prefix",
692
+ "max_length": 63,
693
+ "truncate": "hash",
694
+ "reserved_words": "suffix",
695
+ "reserved_dialects": [
696
+ "postgres",
697
+ "duckdb",
698
+ "snowflake"
699
+ ],
700
+ "on_collision": "error",
701
+ "nested": true
702
+ },
703
+ "stream": {
704
+ "name": "conform",
705
+ "prefix": "",
706
+ "split": null
707
+ },
708
+ "values": {
709
+ "trim": true,
710
+ "null_tokens": [
711
+ "",
712
+ "NULL",
713
+ "null",
714
+ "N/A",
715
+ "n/a",
716
+ "#N/A",
717
+ "NaN",
718
+ "-"
719
+ ],
720
+ "null_tokens_case_sensitive": false,
721
+ "empty_string_for_string": "keep"
722
+ },
723
+ "timestamp": {
724
+ "assume_tz": "UTC",
725
+ "output_precision": "us",
726
+ "formats": [
727
+ "iso"
728
+ ]
729
+ },
730
+ "boolean": {
731
+ "true_values": [
732
+ "true",
733
+ "t",
734
+ "yes",
735
+ "y",
736
+ "1",
737
+ "on"
738
+ ],
739
+ "false_values": [
740
+ "false",
741
+ "f",
742
+ "no",
743
+ "n",
744
+ "0",
745
+ "off"
746
+ ]
747
+ },
748
+ "on_error": "raise",
749
+ "add_record_metadata": false,
750
+ "undeclared": "conform",
751
+ "nested": "json",
752
+ "flatten": {
753
+ "separator": "__",
754
+ "max_depth": 1,
755
+ "max_key_length": 255
756
+ },
757
+ "faker": {
758
+ "seed": null,
759
+ "locale": null
760
+ },
761
+ "engine": "arrow",
762
+ "max_reject_rate": null,
763
+ "max_null_rate": null
764
+ }
765
+ },
766
+ "macros": {
767
+ "type": "object",
768
+ "additionalProperties": {
769
+ "anyOf": [
770
+ {
771
+ "anyOf": [
772
+ {
773
+ "$ref": "#/$defs/Step"
774
+ },
775
+ {
776
+ "type": "array",
777
+ "items": {
778
+ "$ref": "#/$defs/Step"
779
+ },
780
+ "minItems": 1
781
+ }
782
+ ]
783
+ },
784
+ {
785
+ "type": "object",
786
+ "additionalProperties": false,
787
+ "required": [
788
+ "steps"
789
+ ],
790
+ "properties": {
791
+ "steps": {
792
+ "anyOf": [
793
+ {
794
+ "$ref": "#/$defs/Step"
795
+ },
796
+ {
797
+ "type": "array",
798
+ "items": {
799
+ "$ref": "#/$defs/Step"
800
+ },
801
+ "minItems": 1
802
+ }
803
+ ]
804
+ },
805
+ "params": {
806
+ "type": "object"
807
+ },
808
+ "doc": {
809
+ "type": "string"
810
+ }
811
+ }
812
+ }
813
+ ]
814
+ },
815
+ "description": "Named, parameterised transform chains.",
816
+ "default": {}
817
+ },
818
+ "udfs": {
819
+ "type": "object",
820
+ "additionalProperties": {
821
+ "type": "string"
822
+ },
823
+ "description": "Python functions by name, as 'package.module:function'.",
824
+ "default": {}
825
+ },
826
+ "streams": {
827
+ "type": "object",
828
+ "additionalProperties": {
829
+ "$ref": "#/$defs/StreamRules"
830
+ },
831
+ "description": "Per-stream rules: StreamSpec keys plus any Defaults key. A key is a glob over tap stream names, or a new stream name when the rules have source.",
832
+ "default": {}
833
+ },
834
+ "else": {
835
+ "enum": [
836
+ "keep",
837
+ "drop"
838
+ ],
839
+ "description": "Tap streams that match no key: keep (conform with the defaults) or drop.",
840
+ "default": "keep"
841
+ }
842
+ },
843
+ "required": [
844
+ "version"
845
+ ]
846
+ },
847
+ "Step": {
848
+ "description": "A step name, or a mapping whose first key (other than 'when') names the step: its value is the argument and the other keys are keyword arguments. {expr: ...} and {case: [...]} are built in.",
849
+ "anyOf": [
850
+ {
851
+ "type": "string",
852
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
853
+ },
854
+ {
855
+ "type": "object",
856
+ "minProperties": 1
857
+ }
858
+ ]
859
+ },
860
+ "StreamNaming": {
861
+ "description": "How stream names are conformed.",
862
+ "type": "object",
863
+ "additionalProperties": false,
864
+ "properties": {
865
+ "name": {
866
+ "enum": [
867
+ "conform",
868
+ "preserve"
869
+ ],
870
+ "description": "Conform stream names like column names, or keep them.",
871
+ "default": "conform"
872
+ },
873
+ "prefix": {
874
+ "type": "string",
875
+ "description": "Added after conforming.",
876
+ "default": ""
877
+ },
878
+ "split": {
879
+ "type": [
880
+ "string",
881
+ "null"
882
+ ],
883
+ "description": "Emit only the part after the last occurrence of this separator.",
884
+ "default": null
885
+ }
886
+ }
887
+ },
888
+ "StreamRules": {
889
+ "description": "Rules for the streams this key matches: StreamSpec keys plus any Defaults key, which overrides the inherited value (objects merge, lists replace).",
890
+ "type": "object",
891
+ "additionalProperties": false,
892
+ "properties": {
893
+ "alias": {
894
+ "anyOf": [
895
+ {
896
+ "type": "string"
897
+ },
898
+ {
899
+ "$ref": "#/$defs/ExprRef"
900
+ },
901
+ {
902
+ "type": "null"
903
+ }
904
+ ],
905
+ "description": "Final stream name; bypasses stream naming and prefix.",
906
+ "default": null
907
+ },
908
+ "source": {
909
+ "type": [
910
+ "string",
911
+ "null"
912
+ ],
913
+ "description": "Make this key a new output stream projected from this tap stream (split or copy).",
914
+ "default": null
915
+ },
916
+ "prefix": {
917
+ "type": [
918
+ "string",
919
+ "null"
920
+ ],
921
+ "description": "Overrides stream.prefix.",
922
+ "default": null
923
+ },
924
+ "key_properties": {
925
+ "type": [
926
+ "array",
927
+ "null"
928
+ ],
929
+ "items": {
930
+ "type": "string"
931
+ },
932
+ "description": "Overrides the tap's key properties; source or conformed names.",
933
+ "default": null
934
+ },
935
+ "filter": {
936
+ "type": [
937
+ "string",
938
+ "null"
939
+ ],
940
+ "description": "Rows where this expression is falsy are dropped; sees conformed names.",
941
+ "default": null
942
+ },
943
+ "columns": {
944
+ "type": "object",
945
+ "additionalProperties": {
946
+ "$ref": "#/$defs/ColumnSpec"
947
+ },
948
+ "description": "Columns by source name, or by new name for derived columns.",
949
+ "default": {}
950
+ },
951
+ "order": {
952
+ "enum": [
953
+ "source",
954
+ "declared"
955
+ ],
956
+ "description": "Output column order: the tap's, or the order of columns here.",
957
+ "default": "source"
958
+ },
959
+ "drop": {
960
+ "type": "boolean",
961
+ "description": "Drop the whole stream.",
962
+ "default": false
963
+ },
964
+ "naming": {
965
+ "anyOf": [
966
+ {
967
+ "$ref": "#/$defs/NamingDefaults"
968
+ },
969
+ {
970
+ "const": "sdk",
971
+ "description": "Short for {preset: sdk}."
972
+ }
973
+ ],
974
+ "description": "Column naming."
975
+ },
976
+ "stream": {
977
+ "$ref": "#/$defs/StreamNaming",
978
+ "description": "Stream naming."
979
+ },
980
+ "values": {
981
+ "$ref": "#/$defs/ValuesDefaults",
982
+ "description": "Value cleanup."
983
+ },
984
+ "timestamp": {
985
+ "$ref": "#/$defs/TimestampDefaults",
986
+ "description": "Temporal casts."
987
+ },
988
+ "boolean": {
989
+ "$ref": "#/$defs/BooleanDefaults",
990
+ "description": "Boolean casts."
991
+ },
992
+ "on_error": {
993
+ "enum": [
994
+ "raise",
995
+ "null",
996
+ "keep",
997
+ "reject"
998
+ ],
999
+ "description": "What a failed cast or transform does: raise, null, keep the raw value, or reject the row to the dead-letter sink."
1000
+ },
1001
+ "add_record_metadata": {
1002
+ "type": "boolean",
1003
+ "description": "Add the seven Singer SDK _sdc_* columns to SCHEMA, RECORD and BATCH output, as SDK targets do with their setting of the same name."
1004
+ },
1005
+ "undeclared": {
1006
+ "enum": [
1007
+ "conform",
1008
+ "drop",
1009
+ "error"
1010
+ ],
1011
+ "description": "Columns the spec does not mention: conform them from the tap SCHEMA, drop them, or fail."
1012
+ },
1013
+ "nested": {
1014
+ "enum": [
1015
+ "json",
1016
+ "flatten",
1017
+ "keep"
1018
+ ],
1019
+ "description": "Undeclared object and array columns: JSON text, flattened, or typed struct/list."
1020
+ },
1021
+ "flatten": {
1022
+ "$ref": "#/$defs/FlattenDefaults",
1023
+ "description": "Flattening settings."
1024
+ },
1025
+ "faker": {
1026
+ "$ref": "#/$defs/FakerDefaults",
1027
+ "description": "Fake data settings."
1028
+ },
1029
+ "engine": {
1030
+ "enum": [
1031
+ "arrow",
1032
+ "polars"
1033
+ ],
1034
+ "description": "Vectorised BATCH engine: Arrow, or polars (the polars extra), which also vectorises regular expressions and strptime date formats."
1035
+ },
1036
+ "max_reject_rate": {
1037
+ "type": [
1038
+ "number",
1039
+ "null"
1040
+ ],
1041
+ "description": "Fail the run when more than this fraction of a stream's rows is rejected (0-1)."
1042
+ },
1043
+ "max_null_rate": {
1044
+ "type": [
1045
+ "number",
1046
+ "null"
1047
+ ],
1048
+ "description": "Fail the run when on_error: null nulls values in more than this fraction of a stream's rows (0-1)."
1049
+ }
1050
+ }
1051
+ },
1052
+ "StreamSpec": {
1053
+ "description": "A stream's own keys. Defaults keys set on the stream are merged into its Defaults.",
1054
+ "type": "object",
1055
+ "additionalProperties": false,
1056
+ "properties": {
1057
+ "alias": {
1058
+ "anyOf": [
1059
+ {
1060
+ "type": "string"
1061
+ },
1062
+ {
1063
+ "$ref": "#/$defs/ExprRef"
1064
+ },
1065
+ {
1066
+ "type": "null"
1067
+ }
1068
+ ],
1069
+ "description": "Final stream name; bypasses stream naming and prefix.",
1070
+ "default": null
1071
+ },
1072
+ "source": {
1073
+ "type": [
1074
+ "string",
1075
+ "null"
1076
+ ],
1077
+ "description": "Make this key a new output stream projected from this tap stream (split or copy).",
1078
+ "default": null
1079
+ },
1080
+ "prefix": {
1081
+ "type": [
1082
+ "string",
1083
+ "null"
1084
+ ],
1085
+ "description": "Overrides stream.prefix.",
1086
+ "default": null
1087
+ },
1088
+ "key_properties": {
1089
+ "type": [
1090
+ "array",
1091
+ "null"
1092
+ ],
1093
+ "items": {
1094
+ "type": "string"
1095
+ },
1096
+ "description": "Overrides the tap's key properties; source or conformed names.",
1097
+ "default": null
1098
+ },
1099
+ "filter": {
1100
+ "type": [
1101
+ "string",
1102
+ "null"
1103
+ ],
1104
+ "description": "Rows where this expression is falsy are dropped; sees conformed names.",
1105
+ "default": null
1106
+ },
1107
+ "columns": {
1108
+ "type": "object",
1109
+ "additionalProperties": {
1110
+ "$ref": "#/$defs/ColumnSpec"
1111
+ },
1112
+ "description": "Columns by source name, or by new name for derived columns.",
1113
+ "default": {}
1114
+ },
1115
+ "order": {
1116
+ "enum": [
1117
+ "source",
1118
+ "declared"
1119
+ ],
1120
+ "description": "Output column order: the tap's, or the order of columns here.",
1121
+ "default": "source"
1122
+ },
1123
+ "drop": {
1124
+ "type": "boolean",
1125
+ "description": "Drop the whole stream.",
1126
+ "default": false
1127
+ }
1128
+ }
1129
+ },
1130
+ "TimestampDefaults": {
1131
+ "description": "Defaults for temporal casts.",
1132
+ "type": "object",
1133
+ "additionalProperties": false,
1134
+ "properties": {
1135
+ "assume_tz": {
1136
+ "type": "string",
1137
+ "description": "Time zone of naive input cast to timestamptz.",
1138
+ "default": "UTC"
1139
+ },
1140
+ "output_precision": {
1141
+ "enum": [
1142
+ "s",
1143
+ "ms",
1144
+ "us"
1145
+ ],
1146
+ "description": "Fractional precision on output.",
1147
+ "default": "us"
1148
+ },
1149
+ "formats": {
1150
+ "type": "array",
1151
+ "items": {
1152
+ "type": "string"
1153
+ },
1154
+ "description": "Formats tried in order: strftime patterns, iso, excel_serial, epoch_*, rfc2822.",
1155
+ "default": [
1156
+ "iso"
1157
+ ]
1158
+ }
1159
+ }
1160
+ },
1161
+ "ValuesDefaults": {
1162
+ "description": "Value cleanup applied before casting.",
1163
+ "type": "object",
1164
+ "additionalProperties": false,
1165
+ "properties": {
1166
+ "trim": {
1167
+ "type": "boolean",
1168
+ "description": "Trim surrounding whitespace from strings.",
1169
+ "default": true
1170
+ },
1171
+ "null_tokens": {
1172
+ "type": "array",
1173
+ "items": {
1174
+ "type": "string"
1175
+ },
1176
+ "description": "Strings that mean null.",
1177
+ "default": [
1178
+ "",
1179
+ "NULL",
1180
+ "null",
1181
+ "N/A",
1182
+ "n/a",
1183
+ "#N/A",
1184
+ "NaN",
1185
+ "-"
1186
+ ]
1187
+ },
1188
+ "null_tokens_case_sensitive": {
1189
+ "type": "boolean",
1190
+ "description": "Match null tokens case-sensitively.",
1191
+ "default": false
1192
+ },
1193
+ "empty_string_for_string": {
1194
+ "enum": [
1195
+ "keep",
1196
+ "null"
1197
+ ],
1198
+ "description": "What \"\" becomes in a string column.",
1199
+ "default": "keep"
1200
+ }
1201
+ }
1202
+ }
1203
+ }
1204
+ }