metricflow-sql 0.1.1__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 (56) hide show
  1. metricflow_sql/__init__.py +8 -0
  2. metricflow_sql/compiler/__init__.py +0 -0
  3. metricflow_sql/compiler/catalog/__init__.py +0 -0
  4. metricflow_sql/compiler/catalog/cluster.py +152 -0
  5. metricflow_sql/compiler/catalog/information_schema.py +47 -0
  6. metricflow_sql/compiler/catalog/metadata.py +65 -0
  7. metricflow_sql/compiler/catalog/passthrough.py +184 -0
  8. metricflow_sql/compiler/catalog/protocols.py +67 -0
  9. metricflow_sql/compiler/catalog/semantic.py +59 -0
  10. metricflow_sql/compiler/compiler.py +297 -0
  11. metricflow_sql/compiler/rules/__init__.py +0 -0
  12. metricflow_sql/compiler/rules/expand_constellations.py +790 -0
  13. metricflow_sql/compiler/rules/expand_datasets.py +1208 -0
  14. metricflow_sql/compiler/rules/expand_metadata.py +88 -0
  15. metricflow_sql/compiler/rules/isolate_fragments.py +244 -0
  16. metricflow_sql/compiler/rules/passthrough_tables.py +36 -0
  17. metricflow_sql/compiler/table_arguments.py +35 -0
  18. metricflow_sql/converters/__init__.py +0 -0
  19. metricflow_sql/converters/lookml.py +1041 -0
  20. metricflow_sql/objects/__init__.py +0 -0
  21. metricflow_sql/objects/base.py +308 -0
  22. metricflow_sql/objects/constellation.py +210 -0
  23. metricflow_sql/objects/dataset.py +275 -0
  24. metricflow_sql/objects/entity.py +131 -0
  25. metricflow_sql/objects/reference.py +35 -0
  26. metricflow_sql/objects/wiki.py +101 -0
  27. metricflow_sql/py.typed +0 -0
  28. metricflow_sql/registry/__init__.py +0 -0
  29. metricflow_sql/registry/memory.py +409 -0
  30. metricflow_sql/registry/operation.py +25 -0
  31. metricflow_sql/registry/reference_resolution.py +68 -0
  32. metricflow_sql/registry/registry.py +225 -0
  33. metricflow_sql/registry/type_resolver.py +460 -0
  34. metricflow_sql/schemas/__init__.py +0 -0
  35. metricflow_sql/schemas/bundle.py +327 -0
  36. metricflow_sql/schemas/fragment.schema.json +1165 -0
  37. metricflow_sql/schemas/generate.py +70 -0
  38. metricflow_sql/schemas/load.py +333 -0
  39. metricflow_sql/schemas/v1/__init__.py +51 -0
  40. metricflow_sql/schemas/v1/fragment.py +544 -0
  41. metricflow_sql/server/__init__.py +4 -0
  42. metricflow_sql/server/app.py +33 -0
  43. metricflow_sql/server/compile.py +69 -0
  44. metricflow_sql/server/errors.py +10 -0
  45. metricflow_sql/server/serve.py +161 -0
  46. metricflow_sql/utils/__init__.py +0 -0
  47. metricflow_sql/utils/composed_set.py +32 -0
  48. metricflow_sql/utils/normalize.py +74 -0
  49. metricflow_sql/utils/ordered_set.py +24 -0
  50. metricflow_sql/utils/sql.py +226 -0
  51. metricflow_sql/utils/template.py +57 -0
  52. metricflow_sql-0.1.1.dist-info/METADATA +30 -0
  53. metricflow_sql-0.1.1.dist-info/RECORD +56 -0
  54. metricflow_sql-0.1.1.dist-info/WHEEL +4 -0
  55. metricflow_sql-0.1.1.dist-info/entry_points.txt +2 -0
  56. metricflow_sql-0.1.1.dist-info/licenses/LICENSE +29 -0
@@ -0,0 +1,1165 @@
1
+ {
2
+ "$defs": {
3
+ "Assignment": {
4
+ "additionalProperties": false,
5
+ "description": "Defines how a dataset provides a role.\n\nThis is akin to \"dimension conforming\" in traditional dimensional\nmodeling, allowing cross-table analysis - queries reference roles, and the\nphysical location of roles are resolved per dataset.",
6
+ "properties": {
7
+ "description": {
8
+ "anyOf": [
9
+ {
10
+ "type": "string"
11
+ },
12
+ {
13
+ "type": "null"
14
+ }
15
+ ],
16
+ "default": null
17
+ },
18
+ "expr": {
19
+ "description": "A SQL expression, where columns resolve relative to the dataset.",
20
+ "type": "string"
21
+ },
22
+ "label": {
23
+ "anyOf": [
24
+ {
25
+ "type": "string"
26
+ },
27
+ {
28
+ "type": "null"
29
+ }
30
+ ],
31
+ "default": null
32
+ },
33
+ "meta": {
34
+ "default": {},
35
+ "type": "object"
36
+ },
37
+ "name": {
38
+ "description": "The name of the role, unique among the dataset's assignments.",
39
+ "type": "string"
40
+ }
41
+ },
42
+ "required": [
43
+ "name",
44
+ "expr"
45
+ ],
46
+ "title": "Assignment",
47
+ "type": "object"
48
+ },
49
+ "Attribute": {
50
+ "additionalProperties": false,
51
+ "description": "A property of an entity.",
52
+ "properties": {
53
+ "datatype": {
54
+ "anyOf": [
55
+ {
56
+ "type": "string"
57
+ },
58
+ {
59
+ "type": "null"
60
+ }
61
+ ],
62
+ "default": null,
63
+ "description": "Optionally define the datatype. If left null, this will be inferred."
64
+ },
65
+ "description": {
66
+ "anyOf": [
67
+ {
68
+ "type": "string"
69
+ },
70
+ {
71
+ "type": "null"
72
+ }
73
+ ],
74
+ "default": null
75
+ },
76
+ "expr": {
77
+ "description": "SQL expression, where qualified columns reference fields from a source and unqualified columns reference other attributes.",
78
+ "type": "string"
79
+ },
80
+ "label": {
81
+ "anyOf": [
82
+ {
83
+ "type": "string"
84
+ },
85
+ {
86
+ "type": "null"
87
+ }
88
+ ],
89
+ "default": null
90
+ },
91
+ "meta": {
92
+ "default": {},
93
+ "type": "object"
94
+ },
95
+ "name": {
96
+ "description": "The name, unique among its collection's.",
97
+ "type": "string"
98
+ }
99
+ },
100
+ "required": [
101
+ "name",
102
+ "expr"
103
+ ],
104
+ "title": "Attribute",
105
+ "type": "object"
106
+ },
107
+ "Calculation": {
108
+ "additionalProperties": false,
109
+ "description": "A derived column on the dataset.\n\n`expr` is a SQL expression, where columns reference other columns,\ncalculations, or relationships.",
110
+ "properties": {
111
+ "datatype": {
112
+ "anyOf": [
113
+ {
114
+ "type": "string"
115
+ },
116
+ {
117
+ "type": "null"
118
+ }
119
+ ],
120
+ "default": null,
121
+ "description": "Optionally define the datatype. If left null, this will be inferred."
122
+ },
123
+ "description": {
124
+ "anyOf": [
125
+ {
126
+ "type": "string"
127
+ },
128
+ {
129
+ "type": "null"
130
+ }
131
+ ],
132
+ "default": null
133
+ },
134
+ "expr": {
135
+ "description": "A SQL expression, relative to the dataset.",
136
+ "type": "string"
137
+ },
138
+ "label": {
139
+ "anyOf": [
140
+ {
141
+ "type": "string"
142
+ },
143
+ {
144
+ "type": "null"
145
+ }
146
+ ],
147
+ "default": null
148
+ },
149
+ "meta": {
150
+ "default": {},
151
+ "type": "object"
152
+ },
153
+ "name": {
154
+ "description": "The name, unique among its collection's.",
155
+ "type": "string"
156
+ }
157
+ },
158
+ "required": [
159
+ "name",
160
+ "expr"
161
+ ],
162
+ "title": "Calculation",
163
+ "type": "object"
164
+ },
165
+ "Column": {
166
+ "additionalProperties": false,
167
+ "description": "A concrete column in the underlying database.",
168
+ "properties": {
169
+ "datatype": {
170
+ "anyOf": [
171
+ {
172
+ "type": "string"
173
+ },
174
+ {
175
+ "type": "null"
176
+ }
177
+ ],
178
+ "default": null,
179
+ "description": "The column's data type."
180
+ },
181
+ "description": {
182
+ "anyOf": [
183
+ {
184
+ "type": "string"
185
+ },
186
+ {
187
+ "type": "null"
188
+ }
189
+ ],
190
+ "default": null
191
+ },
192
+ "label": {
193
+ "anyOf": [
194
+ {
195
+ "type": "string"
196
+ },
197
+ {
198
+ "type": "null"
199
+ }
200
+ ],
201
+ "default": null
202
+ },
203
+ "meta": {
204
+ "default": {},
205
+ "type": "object"
206
+ },
207
+ "name": {
208
+ "description": "The name, unique among its collection's.",
209
+ "type": "string"
210
+ }
211
+ },
212
+ "required": [
213
+ "name"
214
+ ],
215
+ "title": "Column",
216
+ "type": "object"
217
+ },
218
+ "Constellation": {
219
+ "additionalProperties": false,
220
+ "description": "A group of fact tables connected by conformed dimensions.\n\nConstellations capture higher-order business domains and enable\nmulti-fact queries. Constellations can include configuration from other\nconstellations.",
221
+ "properties": {
222
+ "assignments": {
223
+ "default": [],
224
+ "description": "How datasets provide roles, by dataset.",
225
+ "items": {
226
+ "$ref": "#/$defs/DatasetAssignment"
227
+ },
228
+ "type": "array"
229
+ },
230
+ "description": {
231
+ "anyOf": [
232
+ {
233
+ "type": "string"
234
+ },
235
+ {
236
+ "type": "null"
237
+ }
238
+ ],
239
+ "default": null
240
+ },
241
+ "imports": {
242
+ "default": [],
243
+ "description": "Other constellations to import fields from.",
244
+ "items": {
245
+ "$ref": "#/$defs/Import"
246
+ },
247
+ "type": "array"
248
+ },
249
+ "label": {
250
+ "anyOf": [
251
+ {
252
+ "type": "string"
253
+ },
254
+ {
255
+ "type": "null"
256
+ }
257
+ ],
258
+ "default": null
259
+ },
260
+ "meta": {
261
+ "default": {},
262
+ "type": "object"
263
+ },
264
+ "metrics": {
265
+ "default": [],
266
+ "description": "Metrics of the constellation.",
267
+ "items": {
268
+ "$ref": "#/$defs/Metric"
269
+ },
270
+ "type": "array"
271
+ },
272
+ "name": {
273
+ "description": "The name, unique among its collection's.",
274
+ "type": "string"
275
+ },
276
+ "roles": {
277
+ "default": [],
278
+ "description": "Roles of the constellation.",
279
+ "items": {
280
+ "$ref": "#/$defs/Role"
281
+ },
282
+ "type": "array"
283
+ }
284
+ },
285
+ "required": [
286
+ "name"
287
+ ],
288
+ "title": "Constellation",
289
+ "type": "object"
290
+ },
291
+ "Dataset": {
292
+ "additionalProperties": false,
293
+ "description": "Physical dataset - serves as the input to the semantic layer graph",
294
+ "properties": {
295
+ "calculations": {
296
+ "default": [],
297
+ "description": "Derived columns.",
298
+ "items": {
299
+ "$ref": "#/$defs/Calculation"
300
+ },
301
+ "type": "array"
302
+ },
303
+ "description": {
304
+ "anyOf": [
305
+ {
306
+ "type": "string"
307
+ },
308
+ {
309
+ "type": "null"
310
+ }
311
+ ],
312
+ "default": null
313
+ },
314
+ "key": {
315
+ "default": [],
316
+ "description": "What identifies a row: names of fields, whose values identify rows, and conditions, e.g. `[user_id, {on: ':as_of >= valid_from AND :as_of < valid_to'}]`. Relationships binding all of it are many-to-one. Requires `source`.",
317
+ "items": {
318
+ "anyOf": [
319
+ {
320
+ "type": "string"
321
+ },
322
+ {
323
+ "$ref": "#/$defs/KeyCondition"
324
+ }
325
+ ]
326
+ },
327
+ "type": "array"
328
+ },
329
+ "label": {
330
+ "anyOf": [
331
+ {
332
+ "type": "string"
333
+ },
334
+ {
335
+ "type": "null"
336
+ }
337
+ ],
338
+ "default": null
339
+ },
340
+ "meta": {
341
+ "default": {},
342
+ "type": "object"
343
+ },
344
+ "name": {
345
+ "description": "The name, unique among its collection's.",
346
+ "type": "string"
347
+ },
348
+ "parameters": {
349
+ "default": [],
350
+ "description": "Values a query passes, read by calculations as `:name` and by a `sql` source's template.",
351
+ "items": {
352
+ "$ref": "#/$defs/Parameter"
353
+ },
354
+ "type": "array"
355
+ },
356
+ "relationships": {
357
+ "default": [],
358
+ "description": "References to entities and datasets.",
359
+ "items": {
360
+ "$ref": "#/$defs/Relationship"
361
+ },
362
+ "type": "array"
363
+ },
364
+ "source": {
365
+ "anyOf": [
366
+ {
367
+ "type": "null"
368
+ },
369
+ {
370
+ "$ref": "#/$defs/DatasetSource"
371
+ }
372
+ ],
373
+ "default": null,
374
+ "description": "Source of this dataset (a physical table or a query). Omit it to add calculations and relationships to a dataset whose source another fragment of the bundle defines."
375
+ }
376
+ },
377
+ "required": [
378
+ "name"
379
+ ],
380
+ "title": "Dataset",
381
+ "type": "object"
382
+ },
383
+ "DatasetAssignment": {
384
+ "additionalProperties": false,
385
+ "description": "The roles a dataset provides.",
386
+ "properties": {
387
+ "dataset": {
388
+ "description": "The name of the dataset, unique among the constellation's.",
389
+ "type": "string"
390
+ },
391
+ "meta": {
392
+ "default": {},
393
+ "type": "object"
394
+ },
395
+ "roles": {
396
+ "default": [],
397
+ "description": "How the dataset provides each role.",
398
+ "items": {
399
+ "$ref": "#/$defs/Assignment"
400
+ },
401
+ "type": "array"
402
+ }
403
+ },
404
+ "required": [
405
+ "dataset"
406
+ ],
407
+ "title": "DatasetAssignment",
408
+ "type": "object"
409
+ },
410
+ "DatasetSource": {
411
+ "additionalProperties": false,
412
+ "description": "A physical table, or a query.",
413
+ "properties": {
414
+ "columns": {
415
+ "default": [],
416
+ "description": "Columns of the table or query's rows.",
417
+ "items": {
418
+ "$ref": "#/$defs/Column"
419
+ },
420
+ "type": "array"
421
+ },
422
+ "description": {
423
+ "anyOf": [
424
+ {
425
+ "type": "string"
426
+ },
427
+ {
428
+ "type": "null"
429
+ }
430
+ ],
431
+ "default": null
432
+ },
433
+ "label": {
434
+ "anyOf": [
435
+ {
436
+ "type": "string"
437
+ },
438
+ {
439
+ "type": "null"
440
+ }
441
+ ],
442
+ "default": null
443
+ },
444
+ "location": {
445
+ "anyOf": [
446
+ {
447
+ "type": "string"
448
+ },
449
+ {
450
+ "type": "null"
451
+ }
452
+ ],
453
+ "default": null,
454
+ "description": "The fully-qualified physical table this dataset reads from."
455
+ },
456
+ "meta": {
457
+ "default": {},
458
+ "type": "object"
459
+ },
460
+ "sql": {
461
+ "anyOf": [
462
+ {
463
+ "type": "string"
464
+ },
465
+ {
466
+ "type": "null"
467
+ }
468
+ ],
469
+ "default": null,
470
+ "description": "A query whose rows this dataset reads, e.g. a filtered table. A Jinja template over the dataset's parameters."
471
+ },
472
+ "type": {
473
+ "default": "table",
474
+ "description": "`table` reads `location`; `sql` reads the rows `sql` returns.",
475
+ "enum": [
476
+ "sql",
477
+ "table"
478
+ ]
479
+ }
480
+ },
481
+ "required": [],
482
+ "title": "DatasetSource",
483
+ "type": "object"
484
+ },
485
+ "Entity": {
486
+ "additionalProperties": false,
487
+ "description": "An identifiable, referencable business object.\n\nEntities are like virtual datasets, composed from many datasets.\nAttributes act like an entity's columns.",
488
+ "properties": {
489
+ "attributes": {
490
+ "default": [],
491
+ "description": "Properties of the entity.",
492
+ "items": {
493
+ "$ref": "#/$defs/Attribute"
494
+ },
495
+ "type": "array"
496
+ },
497
+ "description": {
498
+ "anyOf": [
499
+ {
500
+ "type": "string"
501
+ },
502
+ {
503
+ "type": "null"
504
+ }
505
+ ],
506
+ "default": null
507
+ },
508
+ "key": {
509
+ "default": [],
510
+ "description": "The interface that sources must implement and dataset relationships reference.",
511
+ "items": {
512
+ "$ref": "#/$defs/EntityKeyColumn"
513
+ },
514
+ "type": "array"
515
+ },
516
+ "label": {
517
+ "anyOf": [
518
+ {
519
+ "type": "string"
520
+ },
521
+ {
522
+ "type": "null"
523
+ }
524
+ ],
525
+ "default": null
526
+ },
527
+ "meta": {
528
+ "default": {},
529
+ "type": "object"
530
+ },
531
+ "name": {
532
+ "description": "The name, unique among its collection's.",
533
+ "type": "string"
534
+ },
535
+ "sources": {
536
+ "default": [],
537
+ "description": "Datasets implementing the entity's key.",
538
+ "items": {
539
+ "$ref": "#/$defs/Source"
540
+ },
541
+ "type": "array"
542
+ }
543
+ },
544
+ "required": [
545
+ "name"
546
+ ],
547
+ "title": "Entity",
548
+ "type": "object"
549
+ },
550
+ "EntityKeyColumn": {
551
+ "additionalProperties": false,
552
+ "description": "Specification for an individual entity key column.",
553
+ "properties": {
554
+ "datatype": {
555
+ "anyOf": [
556
+ {
557
+ "type": "string"
558
+ },
559
+ {
560
+ "type": "null"
561
+ }
562
+ ],
563
+ "default": null,
564
+ "description": "The key column's data type."
565
+ },
566
+ "meta": {
567
+ "default": {},
568
+ "type": "object"
569
+ },
570
+ "name": {
571
+ "description": "The name, unique among its collection's.",
572
+ "type": "string"
573
+ },
574
+ "optional": {
575
+ "default": false,
576
+ "description": "Whether dataset relationships may omit referencing this key column.",
577
+ "type": "boolean"
578
+ }
579
+ },
580
+ "required": [
581
+ "name"
582
+ ],
583
+ "title": "EntityKeyColumn",
584
+ "type": "object"
585
+ },
586
+ "Fragment": {
587
+ "additionalProperties": false,
588
+ "description": "A piece of a bundle's semantic graph: the fragments of a bundle are merged into it.\n\nDatasets, entities and constellations are named like a warehouse's tables: `sales.orders` is\n`orders` in the `sales` namespace, and a name without a namespace is in `public`. A reference\nwithout a namespace, e.g. a relationship's `entity: customer`, is in the namespace of the\nobject that declares it. A dataset and a constellation can't share a name.",
589
+ "properties": {
590
+ "bundle": {
591
+ "description": "The name of the bundle this fragment is part of, e.g. a dbt project's name. Every fragment in a bundle has the same one: it identifies the bundle when it's published. It's a segment of the bundle's URL, so it can't contain a `/`.",
592
+ "minLength": 1,
593
+ "pattern": "^[^/]+$",
594
+ "type": "string"
595
+ },
596
+ "constellations": {
597
+ "default": [],
598
+ "description": "Constellations.",
599
+ "items": {
600
+ "$ref": "#/$defs/Constellation"
601
+ },
602
+ "type": "array"
603
+ },
604
+ "datasets": {
605
+ "default": [],
606
+ "description": "Datasets.",
607
+ "items": {
608
+ "$ref": "#/$defs/Dataset"
609
+ },
610
+ "type": "array"
611
+ },
612
+ "dialect": {
613
+ "description": "The default SQL dialect used to parse expressions and datatypes.",
614
+ "type": "string"
615
+ },
616
+ "entities": {
617
+ "default": [],
618
+ "description": "Entities.",
619
+ "items": {
620
+ "$ref": "#/$defs/Entity"
621
+ },
622
+ "type": "array"
623
+ },
624
+ "generation_meta": {
625
+ "$ref": "#/$defs/FragmentMetadata",
626
+ "description": "Header describing the production of this fragment."
627
+ },
628
+ "meta": {
629
+ "default": {},
630
+ "type": "object"
631
+ },
632
+ "pages": {
633
+ "default": [],
634
+ "description": "Wiki pages.",
635
+ "items": {
636
+ "$ref": "#/$defs/Page"
637
+ },
638
+ "type": "array"
639
+ },
640
+ "schema_version": {
641
+ "enum": [
642
+ "v1"
643
+ ]
644
+ }
645
+ },
646
+ "required": [
647
+ "schema_version",
648
+ "bundle",
649
+ "dialect"
650
+ ],
651
+ "title": "Fragment",
652
+ "type": "object"
653
+ },
654
+ "FragmentMetadata": {
655
+ "additionalProperties": false,
656
+ "description": "Header describing the production of this fragment.",
657
+ "properties": {
658
+ "env": {
659
+ "anyOf": [
660
+ {
661
+ "type": "string"
662
+ },
663
+ {
664
+ "type": "null"
665
+ }
666
+ ],
667
+ "default": null,
668
+ "description": "Environment"
669
+ },
670
+ "generated_at": {
671
+ "anyOf": [
672
+ {
673
+ "type": "string"
674
+ },
675
+ {
676
+ "type": "null"
677
+ }
678
+ ],
679
+ "default": null,
680
+ "description": "When the fragment was generated."
681
+ },
682
+ "generator_name": {
683
+ "anyOf": [
684
+ {
685
+ "type": "string"
686
+ },
687
+ {
688
+ "type": "null"
689
+ }
690
+ ],
691
+ "default": null,
692
+ "description": "The name of the tool that generated this fragment."
693
+ },
694
+ "generator_version": {
695
+ "anyOf": [
696
+ {
697
+ "type": "string"
698
+ },
699
+ {
700
+ "type": "null"
701
+ }
702
+ ],
703
+ "default": null,
704
+ "description": "The version of the tool that generated this fragment."
705
+ },
706
+ "invocation_id": {
707
+ "anyOf": [
708
+ {
709
+ "type": "string"
710
+ },
711
+ {
712
+ "type": "null"
713
+ }
714
+ ],
715
+ "default": null,
716
+ "description": "The invocation that generated this fragment, if applicable."
717
+ },
718
+ "meta": {
719
+ "default": {},
720
+ "type": "object"
721
+ }
722
+ },
723
+ "required": [],
724
+ "title": "FragmentMetadata",
725
+ "type": "object"
726
+ },
727
+ "Import": {
728
+ "additionalProperties": false,
729
+ "description": "Specification for how one constellation imports another.",
730
+ "properties": {
731
+ "constellation": {
732
+ "description": "The name of the constellation to import from.",
733
+ "type": "string"
734
+ },
735
+ "fields": {
736
+ "anyOf": [
737
+ {
738
+ "type": "string"
739
+ },
740
+ {
741
+ "items": {
742
+ "type": "string"
743
+ },
744
+ "minItems": 1,
745
+ "type": "array"
746
+ }
747
+ ],
748
+ "description": "Which fields to import: `*`, a field name, `!name` to exclude a field, or a list of these, e.g. `['*', '!refunds']`."
749
+ },
750
+ "meta": {
751
+ "default": {},
752
+ "type": "object"
753
+ }
754
+ },
755
+ "required": [
756
+ "constellation",
757
+ "fields"
758
+ ],
759
+ "title": "Import",
760
+ "type": "object"
761
+ },
762
+ "KeyCondition": {
763
+ "additionalProperties": false,
764
+ "description": "A key part that identifies rows by a condition rather than a field's value.\n\nFor example, `:as_of >= valid_from AND :as_of < valid_to` for versions valid\nover a period.",
765
+ "properties": {
766
+ "meta": {
767
+ "default": {},
768
+ "type": "object"
769
+ },
770
+ "on": {
771
+ "description": "A SQL condition, where columns are relative to the dataset and values a relationship binds are `:`-prefixed placeholders, which can't be named like the dataset's fields or parameters.",
772
+ "type": "string"
773
+ },
774
+ "params": {
775
+ "anyOf": [
776
+ {
777
+ "items": {
778
+ "$ref": "#/$defs/KeyParameter"
779
+ },
780
+ "type": "array"
781
+ },
782
+ {
783
+ "type": "null"
784
+ }
785
+ ],
786
+ "default": null,
787
+ "description": "The condition's placeholders. If left null, they are inferred from `on`, and they must be exactly its placeholders otherwise."
788
+ }
789
+ },
790
+ "required": [
791
+ "on"
792
+ ],
793
+ "title": "KeyCondition",
794
+ "type": "object"
795
+ },
796
+ "KeyParameter": {
797
+ "additionalProperties": false,
798
+ "description": "A placeholder of a key condition, e.g. `:as_of`.",
799
+ "properties": {
800
+ "datatype": {
801
+ "anyOf": [
802
+ {
803
+ "type": "string"
804
+ },
805
+ {
806
+ "type": "null"
807
+ }
808
+ ],
809
+ "default": null,
810
+ "description": "The parameter's data type."
811
+ },
812
+ "meta": {
813
+ "default": {},
814
+ "type": "object"
815
+ },
816
+ "name": {
817
+ "description": "The name, unique among its collection's.",
818
+ "type": "string"
819
+ }
820
+ },
821
+ "required": [
822
+ "name"
823
+ ],
824
+ "title": "KeyParameter",
825
+ "type": "object"
826
+ },
827
+ "Metric": {
828
+ "additionalProperties": false,
829
+ "description": "An aggregatable measurement.\n\nMetrics are typically quantitative, but they can be any aggregatable\nvalue. Metrics can span multiple datasets.",
830
+ "properties": {
831
+ "datatype": {
832
+ "anyOf": [
833
+ {
834
+ "type": "string"
835
+ },
836
+ {
837
+ "type": "null"
838
+ }
839
+ ],
840
+ "default": null,
841
+ "description": "Optionally define the datatype. If left null, this will be inferred."
842
+ },
843
+ "description": {
844
+ "anyOf": [
845
+ {
846
+ "type": "string"
847
+ },
848
+ {
849
+ "type": "null"
850
+ }
851
+ ],
852
+ "default": null
853
+ },
854
+ "expr": {
855
+ "description": "A SQL expression, where qualified columns reference fields from datasets and unqualified columns reference other metrics or roles.",
856
+ "type": "string"
857
+ },
858
+ "label": {
859
+ "anyOf": [
860
+ {
861
+ "type": "string"
862
+ },
863
+ {
864
+ "type": "null"
865
+ }
866
+ ],
867
+ "default": null
868
+ },
869
+ "meta": {
870
+ "default": {},
871
+ "type": "object"
872
+ },
873
+ "name": {
874
+ "description": "The name, unique among its collection's.",
875
+ "type": "string"
876
+ }
877
+ },
878
+ "required": [
879
+ "name",
880
+ "expr"
881
+ ],
882
+ "title": "Metric",
883
+ "type": "object"
884
+ },
885
+ "Page": {
886
+ "additionalProperties": false,
887
+ "description": "A markdown wiki page.\n\nLinks to other objects are markdown links with a reference as the URL, e.g.\n`[revenue](metric:sales:revenue)` or `[onboarding](page:guides/onboarding)`.",
888
+ "properties": {
889
+ "content": {
890
+ "anyOf": [
891
+ {
892
+ "type": "string"
893
+ },
894
+ {
895
+ "type": "null"
896
+ }
897
+ ],
898
+ "default": null,
899
+ "description": "The page's markdown, inline. Exclusive with `path`."
900
+ },
901
+ "description": {
902
+ "anyOf": [
903
+ {
904
+ "type": "string"
905
+ },
906
+ {
907
+ "type": "null"
908
+ }
909
+ ],
910
+ "default": null
911
+ },
912
+ "label": {
913
+ "anyOf": [
914
+ {
915
+ "type": "string"
916
+ },
917
+ {
918
+ "type": "null"
919
+ }
920
+ ],
921
+ "default": null
922
+ },
923
+ "meta": {
924
+ "default": {},
925
+ "type": "object"
926
+ },
927
+ "name": {
928
+ "description": "The name, unique among its collection's.",
929
+ "type": "string"
930
+ },
931
+ "path": {
932
+ "anyOf": [
933
+ {
934
+ "type": "string"
935
+ },
936
+ {
937
+ "type": "null"
938
+ }
939
+ ],
940
+ "default": null,
941
+ "description": "Path to a markdown file holding the page's content, relative to this fragment file within its bundle. Exclusive with `content`."
942
+ }
943
+ },
944
+ "required": [
945
+ "name"
946
+ ],
947
+ "title": "Page",
948
+ "type": "object"
949
+ },
950
+ "Parameter": {
951
+ "additionalProperties": false,
952
+ "description": "A value a query passes on its root table function, e.g. `ds(min_quantity => 90)`.",
953
+ "properties": {
954
+ "datatype": {
955
+ "anyOf": [
956
+ {
957
+ "type": "string"
958
+ },
959
+ {
960
+ "type": "null"
961
+ }
962
+ ],
963
+ "default": null,
964
+ "description": "The parameter's data type."
965
+ },
966
+ "default": {
967
+ "anyOf": [
968
+ {
969
+ "type": "string"
970
+ },
971
+ {
972
+ "type": "null"
973
+ }
974
+ ],
975
+ "default": null,
976
+ "description": "A constant used when a query passes nothing; NULL when absent."
977
+ },
978
+ "meta": {
979
+ "default": {},
980
+ "type": "object"
981
+ },
982
+ "name": {
983
+ "description": "The name, unique among its collection's.",
984
+ "type": "string"
985
+ }
986
+ },
987
+ "required": [
988
+ "name"
989
+ ],
990
+ "title": "Parameter",
991
+ "type": "object"
992
+ },
993
+ "Relationship": {
994
+ "additionalProperties": false,
995
+ "description": "A relationship to an entity or a dataset, its target.\n\nA key binding all of the target's key is many-to-one, and any other is\none-to-many.",
996
+ "properties": {
997
+ "cardinality": {
998
+ "anyOf": [
999
+ {
1000
+ "enum": [
1001
+ "many_to_one",
1002
+ "one_to_many"
1003
+ ]
1004
+ },
1005
+ {
1006
+ "type": "null"
1007
+ }
1008
+ ],
1009
+ "default": null,
1010
+ "description": "Optionally declare the cardinality. If left null, this will be inferred from the key, and it must agree with it otherwise."
1011
+ },
1012
+ "description": {
1013
+ "anyOf": [
1014
+ {
1015
+ "type": "string"
1016
+ },
1017
+ {
1018
+ "type": "null"
1019
+ }
1020
+ ],
1021
+ "default": null
1022
+ },
1023
+ "key": {
1024
+ "default": [],
1025
+ "description": "Expressions on this dataset for the target's fields.",
1026
+ "items": {
1027
+ "$ref": "#/$defs/RelationshipKeyColumn"
1028
+ },
1029
+ "type": "array"
1030
+ },
1031
+ "label": {
1032
+ "anyOf": [
1033
+ {
1034
+ "type": "string"
1035
+ },
1036
+ {
1037
+ "type": "null"
1038
+ }
1039
+ ],
1040
+ "default": null
1041
+ },
1042
+ "meta": {
1043
+ "default": {},
1044
+ "type": "object"
1045
+ },
1046
+ "name": {
1047
+ "description": "The name, unique among its collection's.",
1048
+ "type": "string"
1049
+ },
1050
+ "target": {
1051
+ "description": "The name of the related entity or dataset. An entity is looked up first, then a dataset.",
1052
+ "type": "string"
1053
+ }
1054
+ },
1055
+ "required": [
1056
+ "name",
1057
+ "target"
1058
+ ],
1059
+ "title": "Relationship",
1060
+ "type": "object"
1061
+ },
1062
+ "RelationshipKeyColumn": {
1063
+ "additionalProperties": false,
1064
+ "description": "How a relationship binds one of its target's fields.",
1065
+ "properties": {
1066
+ "expr": {
1067
+ "description": "A SQL expression, relative to the dataset.",
1068
+ "type": "string"
1069
+ },
1070
+ "meta": {
1071
+ "default": {},
1072
+ "type": "object"
1073
+ },
1074
+ "name": {
1075
+ "description": "A key column of the target entity, or a key part or field of the target dataset, unique among the key's.",
1076
+ "type": "string"
1077
+ }
1078
+ },
1079
+ "required": [
1080
+ "name",
1081
+ "expr"
1082
+ ],
1083
+ "title": "RelationshipKeyColumn",
1084
+ "type": "object"
1085
+ },
1086
+ "Role": {
1087
+ "additionalProperties": false,
1088
+ "description": "A qualitative property that describes metrics - metrics can be sliced\nand diced by roles.\n\nEach dataset contributing to a constellation can assign fields to a role.",
1089
+ "properties": {
1090
+ "datatype": {
1091
+ "anyOf": [
1092
+ {
1093
+ "type": "string"
1094
+ },
1095
+ {
1096
+ "type": "null"
1097
+ }
1098
+ ],
1099
+ "default": null,
1100
+ "description": "A physical data type, or `REF(<name>)` for a reference to an entity or dataset, in which case datasets must implement the role with a relationship."
1101
+ },
1102
+ "description": {
1103
+ "anyOf": [
1104
+ {
1105
+ "type": "string"
1106
+ },
1107
+ {
1108
+ "type": "null"
1109
+ }
1110
+ ],
1111
+ "default": null
1112
+ },
1113
+ "label": {
1114
+ "anyOf": [
1115
+ {
1116
+ "type": "string"
1117
+ },
1118
+ {
1119
+ "type": "null"
1120
+ }
1121
+ ],
1122
+ "default": null
1123
+ },
1124
+ "meta": {
1125
+ "default": {},
1126
+ "type": "object"
1127
+ },
1128
+ "name": {
1129
+ "description": "The name, unique among its collection's.",
1130
+ "type": "string"
1131
+ }
1132
+ },
1133
+ "required": [
1134
+ "name"
1135
+ ],
1136
+ "title": "Role",
1137
+ "type": "object"
1138
+ },
1139
+ "Source": {
1140
+ "additionalProperties": false,
1141
+ "description": "A dataset sourcing the entity.\n\nEntities have attributes that are sourced from many datasets - a source\ndefines such a dataset.",
1142
+ "properties": {
1143
+ "dataset": {
1144
+ "description": "The name of the dataset, unique among the entity's sources.",
1145
+ "type": "string"
1146
+ },
1147
+ "meta": {
1148
+ "default": {},
1149
+ "type": "object"
1150
+ },
1151
+ "on": {
1152
+ "description": "A SQL expression that defines how the dataset implements the entity's key. Used as the ON clause of JOIN expressions: columns are relative to the dataset, and entity key values from the other side of the join are referencable with `:`-prefixed variables.",
1153
+ "type": "string"
1154
+ }
1155
+ },
1156
+ "required": [
1157
+ "dataset",
1158
+ "on"
1159
+ ],
1160
+ "title": "Source",
1161
+ "type": "object"
1162
+ }
1163
+ },
1164
+ "$ref": "#/$defs/Fragment"
1165
+ }