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.
The dimensions key (the spec synonym for fields) is canonicalized
to fields on construction, so local YAML and remote-fetched state
always compare and render consistently — Unity Catalog currently returns
stored definitions with dimensions even when created with fields.
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. |
definition |
dict[str, Any]
|
The metric view specification as a dictionary, following
the Databricks metric view YAML reference ( |
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\nThe ``dimensions`` key (the spec synonym for ``fields``) is canonicalized\nto ``fields`` on construction, so local YAML and remote-fetched state\nalways compare and render consistently \u2014 Unity Catalog currently returns\nstored definitions with ``dimensions`` even when created with ``fields``.\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 definition: The metric view specification as a dictionary, following\n the Databricks metric view YAML reference (``version``,\n ``source``, ``comment``, ``filter``, ``joins``,\n ``fields``, ``measures``, \u2026).\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"
},
"definition": {
"additionalProperties": true,
"description": "The metric view specification following the Databricks metric view YAML reference, passed through to DDL verbatim (plus optional Kelp-managed 'tags' on field/measure entries)",
"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:Truevalidate_by_alias:Trueserialize_by_alias:True
Fields:
-
origin_file_path(SkipJsonSchema[str] | None) -
name(str) -
catalog(str | None) -
schema_(str | None) -
definition(dict[str, Any]) -
tags(dict[str, str]) -
meta(dict[str, Any]) -
raw_config(SkipJsonSchema[dict])
Validators:
-
_canonicalize_fields_key→definition
definition
pydantic-field
¶
The metric view specification following the Databricks metric view YAML reference, passed through to DDL verbatim (plus optional Kelp-managed 'tags' on field/measure entries)
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 the fully qualified metric view name including catalog/schema if applicable.