Skip to content

kelp.models.metric_view

Reference for the metric_view configuration model.

kelp.models.metric_view.MetricView pydantic-model

Bases: BaseModel

Metric View definition for Databricks.

Attributes:

Name Type Description
name str

The name of the metric view.

catalog str | None

The catalog where the metric view will be created.

schema_ str | None

The schema where the metric view will be created.

description str | None

Optional description of the metric view.

definition dict[str, Any]

The metric view definition as a dictionary. This should contain the full metric view specification including dimensions, metrics, and the underlying table.

tags dict[str, str]

Optional tags for the metric view.

origin_file_path SkipJsonSchema[str] | None

Path to the source YAML file (internal use).

raw_config SkipJsonSchema[dict]

Preserve original, unparsed config (including placeholder vars).

Show JSON schema:
{
  "description": "Metric View definition for Databricks.\n\nAttributes:\n    name: The name of the metric view.\n    catalog: The catalog where the metric view will be created.\n    schema_: The schema where the metric view will be created.\n    description: Optional description of the metric view.\n    definition: The metric view definition as a dictionary. This should contain\n               the full metric view specification including dimensions, metrics,\n               and the underlying table.\n    tags: Optional tags for the metric view.\n    origin_file_path: Path to the source YAML file (internal use).\n    raw_config: Preserve original, unparsed config (including placeholder vars).",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "catalog": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Catalog"
    },
    "schema": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Schema"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Description"
    },
    "definition": {
      "additionalProperties": true,
      "description": "The metric view definition including dimensions, metrics, and source table",
      "title": "Definition",
      "type": "object"
    },
    "tags": {
      "additionalProperties": {
        "type": "string"
      },
      "title": "Tags",
      "type": "object"
    },
    "meta": {
      "additionalProperties": true,
      "description": "Generic user-defined metadata for filtering and grouping",
      "title": "Meta",
      "type": "object"
    }
  },
  "required": [
    "name"
  ],
  "title": "MetricView",
  "type": "object"
}

Config:

  • validate_by_name: True
  • validate_by_alias: True
  • serialize_by_alias: True

Fields:

origin_file_path pydantic-field

origin_file_path = None

name pydantic-field

name

catalog pydantic-field

catalog = None

schema_ pydantic-field

schema_ = None

description pydantic-field

description = None

definition pydantic-field

definition

The metric view definition including dimensions, metrics, and source table

tags pydantic-field

tags

meta pydantic-field

meta

Generic user-defined metadata for filtering and grouping

raw_config pydantic-field

raw_config

model_config class-attribute instance-attribute

model_config = ConfigDict(
    validate_by_name=True,
    validate_by_alias=True,
    serialize_by_alias=True,
)

get_qualified_name

get_qualified_name()

Get the fully qualified metric view name including catalog/schema if applicable.

Source code in src/kelp/models/metric_view.py
def get_qualified_name(self) -> str:
    """Get the fully qualified metric view name including catalog/schema if applicable."""
    parts = []
    if self.catalog:
        parts.append(self.catalog)
    if self.schema_:
        parts.append(self.schema_)
    parts.append(self.name)
    return ".".join(parts)