semolina.introspection¶
The result types of Engine.introspect().
Frozen dataclasses describing a semantic view as the warehouse reports it. Each engine’s
introspect() produces them, and semolina codegen renders them into a
SemanticView subclass. They live outside semolina.codegen because
introspect() is part of the core API, and the CLI’s package is not.
Classes¶
Intermediate representation of a single field from an introspected semantic view. |
|
Intermediate representation of a semantic view returned by engine introspection. |
Module Contents¶
- class semolina.introspection.IntrospectedField[source]¶
Intermediate representation of a single field from an introspected semantic view.
Produced by warehouse introspection engines and consumed by the Python code renderer to generate Metric, Dimension, or Fact field declarations.
- name[source]¶
Python attribute name for the field (e.g., ‘revenue’, ‘country’): the column name folded by its engine (lower-cased for Snowflake and Databricks), then made a valid, unique identifier by
python_field_names().
- data_type[source]¶
Python annotation string (e.g., ‘int’, ‘str’, ‘datetime.date’), or None if the SQL type has no clean Python equivalent (triggers a TODO comment in the generated output).
- description[source]¶
Human-readable description of the field. Defaults to empty string if the warehouse provides no description metadata.
- source_name[source]¶
Original warehouse column name when
namedoes not lead back to it. Set when the column was created with a quoted identifier (e.g.,"order_id"in Snowflake, stored as lowercase), and wheneverpython_field_names()had to change the name (what?becomeswhat_). None for standard columns that round-trip correctly through normalize_identifier.
- raw_type[source]¶
The warehouse’s own spelling of the column type (e.g.
'DECIMAL(38,2)','{"type": "FIXED", "scale": 2}'), carried so the renderer can preserve it as a comment for annotations that do not name it. None means the engine supplied no raw type, and the renderer then emits no comment rather than guessing one.
- class semolina.introspection.IntrospectedView[source]¶
Intermediate representation of a semantic view returned by engine introspection.
Produced by Engine.introspect() and consumed by the Python code renderer to generate a complete SemanticView subclass.
- view_name[source]¶
Warehouse identifier for the view (e.g., ‘sales_view’). Used as the
view=parameter in the generated SemanticView subclass.