Expand description
Catalog ontology views derived from existing builtin definitions.
Enumerates builtins that have ontology: Some(...) and generates 4 views:
- entity_types: from ontology.description + RelationDesc::keys()
- properties: from mz_columns + mz_comments + semantic type inference
- semantic_types: small const reference data
- link_types: from ontology.links on each builtin
Structsยง
- Info ๐
Enumsยง
- Lit ๐
- A single typed SQL literal for use inside a VALUES list.
Constantsยง
- SEMANTIC_
TYPE_ ๐DEFS
Functionsยง
- entity_
types_ ๐view - esc ๐
- Escape single quotes for SQL string literals. Only safe for trusted
compile-time constants (entity names, descriptions, link JSON from
Ontologyannotations) โ never use with user-supplied input. - generate_
views ๐ - leak ๐
- Leak a
BuiltinViewto get a&'staticreference. Called exactly 4 times at startup (one per ontology view). These views live for the entire process lifetime (same asLazyLock<&'static BuiltinView>used by other builtins), so the leak is intentional and bounded. - link_
types_ ๐view - pk_lit ๐
- Extract all keys from a
RelationDescand return aLit::Jsonwith shape:{"primary_key": ["id"], "alternate_keys": [["oid"]]}.primary_keyis the first declared key;alternate_keyscontains any additional unique keys. ReturnsLit::Nullif no keys are defined. - properties_
view ๐ - Build the
mz_ontology_propertiesview: one row per column of every annotated builtin relation. - semantic_
types_ ๐view - sql_
type_ ๐name - Map a
SqlScalarTypeto the SQL type name used in cast expressions. - values_
sql ๐ - Render rows into a SQL
VALUES (r1c1,r1c2,...),(r2c1,...)fragment. Used when a VALUES list appears as a subquery inside a larger SQL string rather than as the top-level source of avalues_view. - values_
view ๐ - Build an ontology view from a static VALUES list. Each row is a
Vec<Lit>; all escaping and type-casting is handled here so callers never touch SQL string formatting directly.