From 6484bab997d3148b918b851c2079411d0a149e5f Mon Sep 17 00:00:00 2001 From: Alice Jia Qi Liu Date: Wed, 24 Jul 2024 19:10:13 -0700 Subject: [PATCH] Generate dbt_yml_files from pydantic classes --- .gitignore | 3 +- pyproject.toml | 28 + .../dbt_yml_files-latest-generated.json | 4711 +++++++++++++++++ schemas/latest/dbt_yml_files-latest.json | 84 +- src/generate.py | 19 + src/latest/dbt_yml_files.py | 1012 ++++ tests/latest/valid/dbt_yml_files.yml | 25 + 7 files changed, 5839 insertions(+), 43 deletions(-) create mode 100644 pyproject.toml create mode 100644 schemas/latest-generated/dbt_yml_files-latest-generated.json create mode 100644 src/generate.py create mode 100644 src/latest/dbt_yml_files.py diff --git a/.gitignore b/.gitignore index 074bbde..873a2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store node_modules/ -.venv \ No newline at end of file +.venv +__pycache__ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..598d133 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "dbt-jsonschema" +version = "0.1.0" +description = '' +readme = "README.md" +requires-python = ">=3.11" +keywords = [] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = ["pydantic >=2.8.0, <3.0.0"] + +[project.urls] +Documentation = "https://github.com/dbt-labs/dbt-jsonschema/blob/main/README.md" +Issues = "https://github.com/dbt-labs/dbt-jsonschema/issues" +Source = "https://github.com/dbt-labs/dbt-jsonschema" + +[tool.hatch.envs.types] +extra-dependencies = ["mypy>=1.0.0"] diff --git a/schemas/latest-generated/dbt_yml_files-latest-generated.json b/schemas/latest-generated/dbt_yml_files-latest-generated.json new file mode 100644 index 0000000..2f0fcf2 --- /dev/null +++ b/schemas/latest-generated/dbt_yml_files-latest-generated.json @@ -0,0 +1,4711 @@ +{ + "$defs": { + "AcceptedValues": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/TestConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "quote": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Quote" + }, + "values": { + "items": { + "type": "string" + }, + "title": "Values", + "type": "array" + }, + "where": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Where" + } + }, + "required": [ + "values" + ], + "title": "AcceptedValues", + "type": "object" + }, + "AcceptedValuesTest": { + "properties": { + "accepted_values": { + "anyOf": [ + { + "$ref": "#/$defs/AcceptedValues" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "AcceptedValuesTest", + "type": "object" + }, + "Access": { + "enum": [ + "private", + "protected", + "public" + ], + "title": "Access", + "type": "string" + }, + "Agg": { + "enum": [ + "SUM", + "MIN", + "MAX", + "AVG", + "COUNT_DISTINCT", + "SUM_BOOLEAN", + "COUNT", + "PERCENTILE", + "MEDIAN", + "sum", + "min", + "max", + "avg", + "count_distinct", + "sum_boolean", + "count", + "percentile", + "median" + ], + "title": "Agg", + "type": "string" + }, + "AggregationTypeParams": { + "additionalProperties": false, + "properties": { + "percentile": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Percentile" + }, + "use_approximate_percentile": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Use Approximate Percentile" + }, + "use_discrete_percentile": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Use Discrete Percentile" + } + }, + "title": "AggregationTypeParams", + "type": "object" + }, + "Analyse": { + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "columns": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Column" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/Config" + }, + { + "type": "null" + } + ], + "default": null + }, + "docs": { + "anyOf": [ + { + "$ref": "#/$defs/DocsConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "name" + ], + "title": "Analyse", + "type": "object" + }, + "Argument": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + } + }, + "required": [ + "name" + ], + "title": "Argument", + "type": "object" + }, + "ArrayOfStrings": { + "items": { + "type": "string" + }, + "title": "ArrayOfStrings", + "type": "array" + }, + "AuthorizedView": { + "additionalProperties": false, + "properties": { + "database": { + "title": "Database", + "type": "string" + }, + "project": { + "title": "Project", + "type": "string" + } + }, + "required": [ + "database", + "project" + ], + "title": "AuthorizedView", + "type": "object" + }, + "BooleanOrJinjaString": { + "anyOf": [ + { + "$ref": "#/$defs/JinjaString" + }, + { + "type": "boolean" + } + ], + "title": "BooleanOrJinjaString" + }, + "Calculation": { + "enum": [ + "conversions", + "conversion_rate", + "CONVERSIONS", + "CONVERSION_RATE" + ], + "title": "Calculation", + "type": "string" + }, + "CategoricalDimension": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "expr": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expr" + }, + "is_partition": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Is Partition" + }, + "type": { + "$ref": "#/$defs/CategoricalDimensionType" + } + }, + "required": [ + "name", + "type" + ], + "title": "CategoricalDimension", + "type": "object" + }, + "CategoricalDimensionType": { + "enum": [ + "CATEGORICAL", + "categorical" + ], + "title": "CategoricalDimensionType", + "type": "string" + }, + "Column": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "data_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Type" + } + }, + "required": [ + "name" + ], + "title": "Column", + "type": "object" + }, + "ColumnProperties": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "constraints": { + "anyOf": [ + { + "$ref": "#/$defs/Constraints" + }, + { + "type": "null" + } + ], + "default": null + }, + "data_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Tests" + }, + "data_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Type" + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "policy_tags": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Configurations, specific to BigQuery adapter, used to set policy tags on specific columns, enabling column-level security. Only relevant when `persist_docs.columns` is true.", + "title": "Policy tags" + }, + "quote": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + } + }, + "required": [ + "name" + ], + "title": "ColumnProperties", + "type": "object" + }, + "Config": { + "additionalProperties": false, + "properties": { + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "Config", + "type": "object" + }, + "ConstantProperty": { + "properties": { + "base_property": { + "description": "DIMENSION or ENTITY", + "title": "Base Property", + "type": "string" + }, + "conversion_property": { + "description": "DIMENSION or ENTITY", + "title": "Conversion Property", + "type": "string" + } + }, + "required": [ + "base_property", + "conversion_property" + ], + "title": "ConstantProperty", + "type": "object" + }, + "Constraint": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "type": { + "title": "Type", + "type": "string" + }, + "columns": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "expression": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expression" + }, + "warn_unenforced": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "warn_unsupported": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "type" + ], + "title": "Constraint", + "type": "object" + }, + "Constraints": { + "items": { + "$ref": "#/$defs/Constraint" + }, + "title": "Constraints", + "type": "array" + }, + "Contract": { + "properties": { + "enforced": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "Contract", + "type": "object" + }, + "ConversionMetric": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "label": { + "title": "Label", + "type": "string" + }, + "type": { + "$ref": "#/$defs/ConversionMetricType" + }, + "type_params": { + "$ref": "#/$defs/ConversionMetricTypeParams" + } + }, + "required": [ + "name", + "label", + "type", + "type_params" + ], + "title": "ConversionMetric", + "type": "object" + }, + "ConversionMetricType": { + "enum": [ + "CONVERSION", + "conversion" + ], + "title": "ConversionMetricType", + "type": "string" + }, + "ConversionMetricTypeParams": { + "additionalProperties": false, + "properties": { + "conversion_type_params": { + "anyOf": [ + { + "$ref": "#/$defs/ConversionTypeParams" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "ConversionMetricTypeParams", + "type": "object" + }, + "ConversionTypeParams": { + "additionalProperties": false, + "properties": { + "base_measure": { + "$ref": "#/$defs/MetricInputMeasure" + }, + "calculation": { + "anyOf": [ + { + "$ref": "#/$defs/Calculation" + }, + { + "type": "null" + } + ], + "default": "conversion_rate" + }, + "constant_properties": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/ConstantProperty" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Constant Properties" + }, + "conversion_measure": { + "$ref": "#/$defs/MetricInputMeasure" + }, + "entity": { + "description": "The entity to calculate over", + "title": "Entity", + "type": "string" + }, + "window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Window" + } + }, + "required": [ + "base_measure", + "conversion_measure", + "entity" + ], + "title": "ConversionTypeParams", + "type": "object" + }, + "CumulativeMetric": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "label": { + "title": "Label", + "type": "string" + }, + "type": { + "$ref": "#/$defs/CumulativeMetricType" + }, + "type_params": { + "$ref": "#/$defs/CumulativeMetricTypeParams" + } + }, + "required": [ + "name", + "label", + "type", + "type_params" + ], + "title": "CumulativeMetric", + "type": "object" + }, + "CumulativeMetricType": { + "enum": [ + "CUMULATIVE", + "cumulative" + ], + "title": "CumulativeMetricType", + "type": "string" + }, + "CumulativeMetricTypeParams": { + "additionalProperties": false, + "properties": { + "grain_to_date": { + "anyOf": [ + { + "$ref": "#/$defs/GrainToDate" + }, + { + "type": "null" + } + ], + "default": null + }, + "measure": { + "anyOf": [ + { + "$ref": "#/$defs/MetricInputMeasure" + }, + { + "type": "null" + } + ], + "default": null + }, + "window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Window" + } + }, + "title": "CumulativeMetricTypeParams", + "type": "object" + }, + "DataTests": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/RelationshipsTest" + }, + { + "$ref": "#/$defs/AcceptedValuesTest" + }, + { + "$ref": "#/$defs/NotNullTest" + }, + { + "$ref": "#/$defs/UniqueTest" + } + ], + "title": "DataTests" + }, + "Defaults": { + "additionalProperties": false, + "properties": { + "agg_time_dimension": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agg Time Dimension" + } + }, + "title": "Defaults", + "type": "object" + }, + "DerivedMetric": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "label": { + "title": "Label", + "type": "string" + }, + "type": { + "$ref": "#/$defs/DerivedMetricType" + }, + "type_params": { + "$ref": "#/$defs/DerivedMetricTypeParams" + } + }, + "required": [ + "name", + "label", + "type", + "type_params" + ], + "title": "DerivedMetric", + "type": "object" + }, + "DerivedMetricType": { + "enum": [ + "DERIVED", + "derived" + ], + "title": "DerivedMetricType", + "type": "string" + }, + "DerivedMetricTypeParams": { + "additionalProperties": false, + "properties": { + "expr": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expr" + }, + "metrics": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/MetricInputSchema" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Metrics" + } + }, + "title": "DerivedMetricTypeParams", + "type": "object" + }, + "Dimension": { + "anyOf": [ + { + "$ref": "#/$defs/CategoricalDimension" + }, + { + "$ref": "#/$defs/TimeDimension" + } + ], + "title": "Dimension" + }, + "DimensionTypeParams": { + "additionalProperties": false, + "properties": { + "time_granularity": { + "$ref": "#/$defs/TimeGranularity" + }, + "validity_params": { + "anyOf": [ + { + "$ref": "#/$defs/ValidityParams" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "time_granularity" + ], + "title": "DimensionTypeParams", + "type": "object" + }, + "DocsConfig": { + "additionalProperties": false, + "properties": { + "node_color": { + "anyOf": [ + { + "pattern": "^(#[a-fA-F0-9]{3}|#[a-fA-F0-9]{6}|[^#][a-zA-Z]*)$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The color of the node on the DAG in the documentation. It must be an Hex code or a valid CSS color name.", + "title": "Node Color" + }, + "show": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": true, + "title": "Show" + } + }, + "title": "DocsConfig", + "type": "object" + }, + "Entity": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "type": { + "allOf": [ + { + "$ref": "#/$defs/EntityType" + } + ], + "title": "Entity Type" + }, + "entity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entity" + }, + "expr": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expr" + } + }, + "required": [ + "name", + "type" + ], + "title": "Entity", + "type": "object" + }, + "EntityType": { + "enum": [ + "PRIMARY", + "UNIQUE", + "FOREIGN", + "NATURAL", + "primary", + "unique", + "foreign", + "natural" + ], + "title": "EntityType", + "type": "string" + }, + "ExpectCSV": { + "properties": { + "format": { + "const": "csv", + "default": "csv", + "enum": [ + "csv" + ], + "title": "Format", + "type": "string" + }, + "rows": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "When `format` is csv or sql, a string containing comma-separated headers and values. Alternatively provide a fixture. Use the pipe character | to create a multi-line string in YAML.", + "title": "Rows" + }, + "fixture": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Specify the name of a fixture instead of providing `rows`.", + "title": "Fixture" + } + }, + "title": "ExpectCSV", + "type": "object" + }, + "ExpectDict": { + "properties": { + "format": { + "const": "dict", + "default": "dict", + "enum": [ + "dict" + ], + "title": "Format", + "type": "string" + }, + "rows": { + "description": "When `format` is `dict`, each item should be a dictionary containing a key-value pair for each column and its value, e.g. `{id: 1, code: 'ABC'}`", + "items": { + "type": "object" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "rows" + ], + "title": "ExpectDict", + "type": "object" + }, + "ExpectSQL": { + "properties": { + "format": { + "const": "sql", + "default": "sql", + "enum": [ + "sql" + ], + "title": "Format", + "type": "string" + }, + "rows": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "When `format` is csv or sql, a string containing comma-separated headers and values. Alternatively provide a fixture. Use the pipe character | to create a multi-line string in YAML.", + "title": "Rows" + }, + "fixture": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Specify the name of a fixture instead of providing `rows`.", + "title": "Fixture" + } + }, + "title": "ExpectSQL", + "type": "object" + }, + "Export": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/ExportConfig" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Export Config" + } + }, + "required": [ + "name" + ], + "title": "Export", + "type": "object" + }, + "ExportAs": { + "enum": [ + "table", + "view", + "cache" + ], + "title": "ExportAs", + "type": "string" + }, + "ExportConfig": { + "additionalProperties": true, + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alias" + }, + "export_as": { + "anyOf": [ + { + "$ref": "#/$defs/ExportAs" + }, + { + "type": "null" + } + ], + "default": null + }, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Schema" + } + }, + "title": "ExportConfig", + "type": "object" + }, + "Exposure": { + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "type": { + "$ref": "#/$defs/Type" + }, + "depends_on": { + "items": { + "type": "string" + }, + "title": "Depends On", + "type": "array" + }, + "label": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Label" + }, + "maturity": { + "anyOf": [ + { + "$ref": "#/$defs/Maturity" + }, + { + "type": "null" + } + ], + "default": null + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "owner": { + "anyOf": [ + { + "$ref": "#/$defs/OwnerWithEmail" + }, + { + "$ref": "#/$defs/OwnerWithName" + } + ], + "title": "Owner" + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Url" + } + }, + "required": [ + "name", + "type", + "depends_on", + "owner" + ], + "title": "Exposure", + "type": "object" + }, + "Format": { + "enum": [ + "csv", + "dict", + "sql" + ], + "title": "Format", + "type": "string" + }, + "FreshnessDefinition": { + "anyOf": [ + { + "$ref": "#/$defs/FreshnessDefinition1" + }, + { + "type": "null" + } + ], + "title": "FreshnessDefinition" + }, + "FreshnessDefinition1": { + "additionalProperties": false, + "properties": { + "error_after": { + "anyOf": [ + { + "$ref": "#/$defs/FreshnessRules" + }, + { + "type": "null" + } + ], + "default": null + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "warn_after": { + "anyOf": [ + { + "$ref": "#/$defs/FreshnessRules" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "FreshnessDefinition1", + "type": "object" + }, + "FreshnessRules": { + "additionalProperties": false, + "properties": { + "count": { + "$ref": "#/$defs/NumberOrJinjaString" + }, + "period": { + "$ref": "#/$defs/Period" + } + }, + "required": [ + "count", + "period" + ], + "title": "FreshnessRules", + "type": "object" + }, + "GivenItem": { + "properties": { + "fixture": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Only relevant when format is csv. Specify the name of a fixture instead of providing `rows`.", + "title": "Fixture" + }, + "format": { + "anyOf": [ + { + "$ref": "#/$defs/Format" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Defaults to `dict` when not specified" + }, + "input": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The relation whose inputs you need to mock. Enclose in ref or source without curly braces", + "examples": [ + "ref('model_b')", + "ref('upstream_project', 'model_b')", + "source('schema', 'table')" + ], + "title": "Input" + }, + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null, + "title": "Additionalproperties" + } + }, + "title": "GivenItem", + "type": "object" + }, + "GrainToDate": { + "enum": [ + "day", + "week", + "month", + "quarter", + "year" + ], + "title": "GrainToDate", + "type": "string" + }, + "Grants": { + "additionalProperties": { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + "description": "grant config. each key is a database permission and the value is the grantee of that permission", + "title": "Grants", + "type": "object" + }, + "Group": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "owner": { + "anyOf": [ + { + "$ref": "#/$defs/OwnerWithEmail" + }, + { + "$ref": "#/$defs/OwnerWithName" + } + ], + "title": "Owner" + } + }, + "required": [ + "name", + "owner" + ], + "title": "Group", + "type": "object" + }, + "GroupName": { + "title": "GroupName", + "type": "string" + }, + "IncludeExclude": { + "properties": { + "exclude": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "include": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "IncludeExclude", + "type": "object" + }, + "JinjaString": { + "pattern": "\\{\\{.*\\}\\}", + "title": "JinjaString", + "type": "string" + }, + "Macro": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "arguments": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Argument" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Arguments" + }, + "docs": { + "anyOf": [ + { + "$ref": "#/$defs/DocsConfig" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "name" + ], + "title": "Macro", + "type": "object" + }, + "Maturity": { + "enum": [ + "high", + "medium", + "low" + ], + "title": "Maturity", + "type": "string" + }, + "Measure": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "agg": { + "$ref": "#/$defs/Agg" + }, + "agg_params": { + "anyOf": [ + { + "$ref": "#/$defs/AggregationTypeParams" + }, + { + "type": "null" + } + ], + "default": null + }, + "agg_time_dimension": { + "anyOf": [ + { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Agg Time Dimension" + }, + "create_metric": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Create Metric" + }, + "create_metric_display_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Create Metric Display Name" + }, + "expr": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expr" + }, + "label": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Label" + }, + "non_additive_dimension": { + "anyOf": [ + { + "$ref": "#/$defs/NonAdditiveDimension" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "required": [ + "name", + "agg" + ], + "title": "Measure", + "type": "object" + }, + "MetricInputMeasure": { + "additionalProperties": false, + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "fill_nulls_with": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Fill Nulls With" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "join_to_timespine": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Join To Timespine" + } + }, + "title": "MetricInputMeasure", + "type": "object" + }, + "MetricInputSchema": { + "additionalProperties": false, + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alias" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "offset_window": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Offset Window" + } + }, + "title": "MetricInputSchema", + "type": "object" + }, + "Model": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "access": { + "anyOf": [ + { + "$ref": "#/$defs/Access" + }, + { + "type": "null" + } + ], + "default": null + }, + "columns": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/ColumnProperties" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/ModelConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "constraints": { + "anyOf": [ + { + "$ref": "#/$defs/Constraints" + }, + { + "type": "null" + } + ], + "default": null + }, + "data_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Tests" + }, + "deprecation_date": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Deprecation Date" + }, + "docs": { + "anyOf": [ + { + "$ref": "#/$defs/DocsConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "latest_version": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Latest Version" + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + }, + "versions": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Version" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Versions" + } + }, + "required": [ + "name" + ], + "title": "Model", + "type": "object" + }, + "ModelConfigs": { + "properties": { + "auto_refresh": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "backup": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "contract": { + "anyOf": [ + { + "$ref": "#/$defs/Contract" + }, + { + "type": "null" + } + ], + "default": null + }, + "file_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "File Format" + }, + "grant_access_to": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/AuthorizedView" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", + "title": "Authorized views" + }, + "grants": { + "anyOf": [ + { + "$ref": "#/$defs/Grants" + }, + { + "type": "null" + } + ], + "default": null + }, + "hours_to_expiration": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table.", + "title": "Hours To Expiration" + }, + "kms_key_name": { + "anyOf": [ + { + "pattern": "projects/[a-zA-Z0-9_-]*/locations/[a-zA-Z0-9_-]*/keyRings/.*/cryptoKeys/.*", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Configuration of the KMS key name, specific to BigQuery adapter.", + "title": "Kms Key Name" + }, + "labels": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Configuration specific to BigQuery adapter used to add labels and tags to tables/views created by dbt.", + "title": "Label configs" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "materialized": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Materialized" + }, + "on_configuration_change": { + "anyOf": [ + { + "$ref": "#/$defs/OnConfigurationChange" + }, + { + "type": "null" + } + ], + "default": null + }, + "on_schema_change": { + "anyOf": [ + { + "$ref": "#/$defs/OnSchemaChange" + }, + { + "type": "null" + } + ], + "default": null + }, + "snowflake_warehouse": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Snowflake Warehouse" + }, + "sql_header": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sql Header" + }, + "target_lag": { + "anyOf": [ + { + "pattern": "^(?:downstream|\\d+\\s*(?:seconds|minutes|hours|days))$", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Lag" + } + }, + "title": "ModelConfigs", + "type": "object" + }, + "NonAdditiveDimension": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "window_choice": { + "anyOf": [ + { + "$ref": "#/$defs/WindowChoice" + }, + { + "type": "null" + } + ], + "default": null + }, + "window_groupings": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Window Groupings" + } + }, + "required": [ + "name" + ], + "title": "NonAdditiveDimension", + "type": "object" + }, + "NotNull": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/TestConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "where": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Where" + } + }, + "title": "NotNull", + "type": "object" + }, + "NotNullTest": { + "properties": { + "not_null": { + "anyOf": [ + { + "$ref": "#/$defs/NotNull" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "NotNullTest", + "type": "object" + }, + "NumberOrJinjaString": { + "anyOf": [ + { + "$ref": "#/$defs/JinjaString" + }, + { + "type": "number" + } + ], + "title": "NumberOrJinjaString" + }, + "OnConfigurationChange": { + "enum": [ + "apply", + "continue", + "fail" + ], + "title": "OnConfigurationChange", + "type": "string" + }, + "OnSchemaChange": { + "enum": [ + "append_new_columns", + "fail", + "ignore", + "sync_all_columns" + ], + "title": "OnSchemaChange", + "type": "string" + }, + "Overrides": { + "additionalProperties": false, + "properties": { + "env_vars": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Env Vars" + }, + "macros": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + { + "is_incremental": "true" + } + ], + "title": "Macros" + }, + "vars": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Vars" + } + }, + "title": "Overrides", + "type": "object" + }, + "OwnerWithEmail": { + "additionalProperties": false, + "properties": { + "email": { + "title": "Email", + "type": "string" + } + }, + "required": [ + "email" + ], + "title": "OwnerWithEmail", + "type": "object" + }, + "OwnerWithName": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "OwnerWithName", + "type": "object" + }, + "Period": { + "enum": [ + "minute", + "hour", + "day" + ], + "title": "Period", + "type": "string" + }, + "PersistDocsConfig": { + "additionalProperties": false, + "properties": { + "columns": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ] + }, + "relation": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ] + } + }, + "title": "PersistDocsConfig", + "type": "object" + }, + "QueryParams": { + "properties": { + "dimensions": { + "anyOf": [ + { + "$ref": "#/$defs/ArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "metrics": { + "anyOf": [ + { + "$ref": "#/$defs/ArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "where": { + "anyOf": [ + { + "$ref": "#/$defs/ArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null, + "title": "Additionalproperties" + } + }, + "title": "QueryParams", + "type": "object" + }, + "Quoting": { + "additionalProperties": false, + "properties": { + "database": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "identifier": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "schema": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "Quoting", + "type": "object" + }, + "RatioMetric": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "label": { + "title": "Label", + "type": "string" + }, + "type": { + "$ref": "#/$defs/RatioMetricType" + }, + "type_params": { + "$ref": "#/$defs/RatioMetricTypeParams" + } + }, + "required": [ + "name", + "label", + "type", + "type_params" + ], + "title": "RatioMetric", + "type": "object" + }, + "RatioMetricType": { + "enum": [ + "RATIO", + "ratio" + ], + "title": "RatioMetricType", + "type": "string" + }, + "RatioMetricTypeParams": { + "additionalProperties": false, + "properties": { + "denominator": { + "anyOf": [ + { + "$ref": "#/$defs/MetricInputSchema" + }, + { + "type": "null" + } + ], + "default": null + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "numerator": { + "anyOf": [ + { + "$ref": "#/$defs/MetricInputSchema" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RatioMetricTypeParams", + "type": "object" + }, + "Relationships": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/TestConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "field": { + "description": "The foreign key column", + "title": "Relationships: Field", + "type": "string" + }, + "to": { + "examples": [ + "ref('parent_model')", + "source('parent_schema', 'parent_table')" + ], + "title": "To", + "type": "string" + }, + "where": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Where" + } + }, + "required": [ + "field", + "to" + ], + "title": "Relationships", + "type": "object" + }, + "RelationshipsTest": { + "properties": { + "relationships": { + "anyOf": [ + { + "$ref": "#/$defs/Relationships" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "RelationshipsTest", + "type": "object" + }, + "SavedQuery": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + }, + "exports": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Export" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Exports" + }, + "label": { + "title": "Label", + "type": "string" + }, + "query_params": { + "$ref": "#/$defs/QueryParams" + } + }, + "required": [ + "name", + "description", + "label", + "query_params" + ], + "title": "SavedQuery", + "type": "object" + }, + "Seed": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "columns": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/ColumnProperties" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/SeedConfig" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Seed Config" + }, + "docs": { + "anyOf": [ + { + "$ref": "#/$defs/DocsConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + } + }, + "required": [ + "name" + ], + "title": "Seed", + "type": "object" + }, + "SeedConfig": { + "properties": { + "column_types": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Column Types" + }, + "copy_grants": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "data_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Tests" + }, + "database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Database" + }, + "enabled": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "grants": { + "anyOf": [ + { + "$ref": "#/$defs/Grants" + }, + { + "type": "null" + } + ], + "default": null + }, + "quote_columns": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Schema" + } + }, + "title": "SeedConfig", + "type": "object" + }, + "SemanticModel": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/Defaults" + }, + { + "type": "null" + } + ], + "default": null + }, + "dimensions": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Dimension" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Dimensions" + }, + "entities": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Entity" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Entities" + }, + "measures": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Measure" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Measures" + }, + "model": { + "title": "Model", + "type": "string" + }, + "primary_entity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Primary Entity" + } + }, + "required": [ + "name", + "model" + ], + "title": "SemanticModel", + "type": "object" + }, + "Severity": { + "enum": [ + "warn", + "error" + ], + "title": "Severity", + "type": "string" + }, + "SimpleMetric": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filter" + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "label": { + "title": "Label", + "type": "string" + }, + "type": { + "$ref": "#/$defs/SimpleMetricType" + }, + "type_params": { + "$ref": "#/$defs/SimpleMetricTypeParams" + } + }, + "required": [ + "name", + "label", + "type", + "type_params" + ], + "title": "SimpleMetric", + "type": "object" + }, + "SimpleMetricType": { + "enum": [ + "SIMPLE", + "simple" + ], + "title": "SimpleMetricType", + "type": "string" + }, + "SimpleMetricTypeParams": { + "additionalProperties": false, + "properties": { + "measure": { + "anyOf": [ + { + "$ref": "#/$defs/MetricInputMeasure" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "SimpleMetricTypeParams", + "type": "object" + }, + "Snapshot": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "columns": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/ColumnProperties" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/SnapshotConfig" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Snapshot Config" + }, + "data_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Tests" + }, + "docs": { + "anyOf": [ + { + "$ref": "#/$defs/DocsConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "group": { + "anyOf": [ + { + "$ref": "#/$defs/GroupName" + }, + { + "type": "null" + } + ], + "default": null + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + } + }, + "required": [ + "name" + ], + "title": "Snapshot", + "type": "object" + }, + "SnapshotConfig": { + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alias" + }, + "check_cols": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "enabled": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "grants": { + "anyOf": [ + { + "$ref": "#/$defs/Grants" + }, + { + "type": "null" + } + ], + "default": null + }, + "persist_docs": { + "anyOf": [ + { + "$ref": "#/$defs/PersistDocsConfig" + }, + { + "type": "null" + } + ], + "default": null + }, + "post-hook": { + "anyOf": [ + { + "$ref": "#/$defs/ArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "pre-hook": { + "anyOf": [ + { + "$ref": "#/$defs/ArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "quote_columns": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "strategy": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Strategy" + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "target_database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Database" + }, + "target_schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Target Schema" + }, + "unique_key": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "updated_at": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Updated At" + } + }, + "title": "SnapshotConfig", + "type": "object" + }, + "Source": { + "properties": { + "name": { + "description": "How you will identify the schema in {{ source() }} calls. Unless `schema` is also set, this will be the name of the schema in the database.", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "config": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Config" + }, + "data_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Data Tests" + }, + "database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Database" + }, + "freshness": { + "anyOf": [ + { + "$ref": "#/$defs/FreshnessDefinition" + }, + { + "type": "null" + } + ], + "default": null + }, + "loaded_at_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loaded At Field" + }, + "loader": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loader" + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "overrides": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The name of another package installed in your project. If that package has a source with the same name as this one, its properties will be applied on top of the base properties of the overridden source. https://docs.getdbt.com/reference/resource-properties/overrides", + "title": "Package to Override" + }, + "quoting": { + "anyOf": [ + { + "$ref": "#/$defs/Quoting" + }, + { + "type": "null" + } + ], + "default": null + }, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The schema name as stored in the database. Only needed if you want to use a different `name` than what exists in the database (otherwise `name` is used by default)", + "title": "Schema" + }, + "tables": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Table" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tables" + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + } + }, + "required": [ + "name" + ], + "title": "Source", + "type": "object" + }, + "StringOrArrayOfStrings": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/ArrayOfStrings" + } + ], + "title": "StringOrArrayOfStrings" + }, + "Table": { + "additionalProperties": false, + "properties": { + "name": { + "description": "How you will identify the table in {{ source() }} calls. Unless `identifier` is also set, this will be the name of the table in the database.", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "columns": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/ColumnProperties" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "external": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "External" + }, + "freshness": { + "anyOf": [ + { + "$ref": "#/$defs/FreshnessDefinition" + }, + { + "type": "null" + } + ], + "default": null + }, + "identifier": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The table name as stored in the database. Only needed if you want to give the source a different name than what exists in the database (otherwise `name` is used by default)", + "title": "Identifier" + }, + "loaded_at_field": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Which column to check during data freshness tests. Only needed if the table has a different loaded_at_field to the one defined on the source overall.", + "title": "Loaded At Field" + }, + "loader": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loader" + }, + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "quoting": { + "anyOf": [ + { + "$ref": "#/$defs/Quoting" + }, + { + "type": "null" + } + ], + "default": null + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataTests" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tests" + } + }, + "required": [ + "name" + ], + "title": "Table", + "type": "object" + }, + "TestConfigs": { + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Only relevant when `store_failures` is true", + "title": "Alias" + }, + "database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Only relevant when `store_failures` is true", + "title": "Database" + }, + "enabled": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "error_if": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Error If" + }, + "fail_calc": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Fail Calc" + }, + "limit": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Limit" + }, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Only relevant when `store_failures` is true", + "title": "Schema" + }, + "severity": { + "anyOf": [ + { + "$ref": "#/$defs/JinjaString" + }, + { + "$ref": "#/$defs/Severity" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Severity" + }, + "store_failures": { + "anyOf": [ + { + "$ref": "#/$defs/BooleanOrJinjaString" + }, + { + "type": "null" + } + ], + "default": null + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + }, + "warn_if": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Warn If" + } + }, + "title": "TestConfigs", + "type": "object" + }, + "TimeDimension": { + "additionalProperties": false, + "properties": { + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "expr": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Expr" + }, + "is_partition": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Is Partition" + }, + "type": { + "$ref": "#/$defs/TimeDimensionType" + }, + "type_params": { + "$ref": "#/$defs/DimensionTypeParams" + } + }, + "required": [ + "name", + "type", + "type_params" + ], + "title": "TimeDimension", + "type": "object" + }, + "TimeDimensionType": { + "enum": [ + "TIME", + "time" + ], + "title": "TimeDimensionType", + "type": "string" + }, + "TimeGranularity": { + "enum": [ + "DAY", + "WEEK", + "MONTH", + "QUARTER", + "YEAR", + "day", + "week", + "month", + "quarter", + "year" + ], + "title": "TimeGranularity", + "type": "string" + }, + "Type": { + "enum": [ + "dashboard", + "notebook", + "analysis", + "ml", + "application" + ], + "title": "Type", + "type": "string" + }, + "Unique": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/TestConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "where": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Where" + } + }, + "title": "Unique", + "type": "object" + }, + "UniqueTest": { + "properties": { + "unique": { + "anyOf": [ + { + "$ref": "#/$defs/Unique" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "UniqueTest", + "type": "object" + }, + "UnitTest": { + "additionalProperties": false, + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/UnitTestConfig" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit Test Config" + }, + "expect": { + "anyOf": [ + { + "$ref": "#/$defs/ExpectDict" + }, + { + "$ref": "#/$defs/ExpectCSV" + }, + { + "$ref": "#/$defs/ExpectSQL" + } + ], + "title": "Expect" + }, + "given": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/GivenItem" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Given" + }, + "model": { + "description": "The name of the model whose behaviour you are testing. Does not need to be wrapped in a ref.", + "examples": [ + "my_model" + ], + "title": "Model", + "type": "string" + }, + "overrides": { + "anyOf": [ + { + "$ref": "#/$defs/Overrides" + }, + { + "type": "null" + } + ], + "default": null + }, + "additionalProperties": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null, + "title": "Additionalproperties" + } + }, + "required": [ + "name", + "expect", + "model" + ], + "title": "UnitTest", + "type": "object" + }, + "UnitTestConfig": { + "additionalProperties": false, + "properties": { + "meta": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Meta" + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/StringOrArrayOfStrings" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "title": "UnitTestConfig", + "type": "object" + }, + "ValidityParams": { + "additionalProperties": false, + "properties": { + "is_end": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Is End" + }, + "is_start": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Is Start" + } + }, + "title": "ValidityParams", + "type": "object" + }, + "Version": { + "properties": { + "columns": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "$ref": "#/$defs/IncludeExclude" + }, + { + "$ref": "#/$defs/ColumnProperties" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Columns" + }, + "config": { + "anyOf": [ + { + "$ref": "#/$defs/ModelConfigs" + }, + { + "type": "null" + } + ], + "default": null + }, + "v": { + "title": "V", + "type": "number" + } + }, + "required": [ + "v" + ], + "title": "Version", + "type": "object" + }, + "WindowChoice": { + "enum": [ + "MIN", + "MAX", + "min", + "max" + ], + "title": "WindowChoice", + "type": "string" + } + }, + "additionalProperties": false, + "properties": { + "version": { + "const": 2, + "default": 2, + "enum": [ + 2 + ], + "title": "Version", + "type": "integer" + }, + "analyses": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Analyse" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Analyses" + }, + "exposures": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Exposure" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Exposures" + }, + "groups": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Group" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Groups" + }, + "macros": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Macro" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Macros" + }, + "metrics": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "$ref": "#/$defs/SimpleMetric" + }, + { + "$ref": "#/$defs/DerivedMetric" + }, + { + "$ref": "#/$defs/CumulativeMetric" + }, + { + "$ref": "#/$defs/ConversionMetric" + }, + { + "$ref": "#/$defs/RatioMetric" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Metrics" + }, + "models": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Model" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Models" + }, + "saved_queries": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/SavedQuery" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Saved Queries" + }, + "seeds": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Seed" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Seeds" + }, + "semantic_models": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/SemanticModel" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Semantic Models" + }, + "snapshots": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Snapshot" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Snapshots" + }, + "sources": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Source" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Sources" + }, + "unit_tests": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/UnitTest" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit Tests" + } + }, + "title": "DbtYmlFiles", + "type": "object" +} \ No newline at end of file diff --git a/schemas/latest/dbt_yml_files-latest.json b/schemas/latest/dbt_yml_files-latest.json index a0e146d..b8c757b 100644 --- a/schemas/latest/dbt_yml_files-latest.json +++ b/schemas/latest/dbt_yml_files-latest.json @@ -55,7 +55,7 @@ "$ref": "#/$defs/docs_config" }, "group": { - "$ref": "#/$defs/group" + "$ref": "#/$defs/group_name" } } } @@ -110,28 +110,7 @@ "type": "object" }, "owner": { - "type": "object", - "anyOf": [ - { - "required": [ - "email" - ] - }, - { - "required": [ - "name" - ] - } - ], - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - } - }, - "additionalProperties": false + "$ref": "#/$defs/owner" }, "tags": { "$ref": "#/$defs/string_or_array_of_strings" @@ -155,17 +134,7 @@ "type": "string" }, "owner": { - "type": "object", - "minProperties": 1, - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - } - }, - "additionalProperties": true + "$ref": "#/$defs/owner" } }, "additionalProperties": false @@ -325,6 +294,7 @@ "type": "string" }, "type": { + "title": "Metric Type", "enum": [ "SIMPLE", "RATIO", @@ -342,7 +312,7 @@ "type": "string" }, "group": { - "$ref": "#/$defs/group" + "$ref": "#/$defs/group_name" }, "label": { "type": "string" @@ -401,7 +371,7 @@ "$ref": "#/$defs/docs_config" }, "group": { - "$ref": "#/$defs/group" + "$ref": "#/$defs/group_name" }, "latest_version": { "type": "number" @@ -515,6 +485,7 @@ } }, "config": { + "title": "Seed Config", "type": "object", "properties": { "column_types": { @@ -550,7 +521,7 @@ "$ref": "#/$defs/docs_config" }, "group": { - "$ref": "#/$defs/group" + "$ref": "#/$defs/group_name" }, "tests": { "type": "array", @@ -637,6 +608,7 @@ } }, "config": { + "title": "Snapshot Config", "type": "object", "properties": { "alias": { @@ -693,7 +665,7 @@ "$ref": "#/$defs/docs_config" }, "group": { - "$ref": "#/$defs/group" + "$ref": "#/$defs/group_name" }, "meta": { "type": "object" @@ -871,6 +843,7 @@ "type": "string" }, "config": { + "title": "Unit Test Config", "type": "object", "properties": { "meta": { @@ -919,9 +892,9 @@ "description": "Defaults to `dict` when not specified", "type": "string", "enum": [ + "csv", "dict", - "sql", - "csv" + "sql" ] }, "additionalProperties": false @@ -966,8 +939,8 @@ "description": "Defaults to `dict` when not specified", "type": "string", "enum": [ - "dict", "csv", + "dict", "sql" ] }, @@ -1371,6 +1344,7 @@ "type": "string" }, "type": { + "title": "Dimension Type", "enum": [ "CATEGORICAL", "TIME", @@ -1448,6 +1422,7 @@ "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$" }, "type": { + "title": "Entity Type", "enum": [ "PRIMARY", "UNIQUE", @@ -1481,6 +1456,7 @@ "type": "string" }, "config": { + "title": "Export Config", "type": "object", "properties": { "alias": { @@ -1565,7 +1541,7 @@ }, "additionalProperties": false }, - "group": { + "group_name": { "type": "string" }, "include_exclude": { @@ -1804,6 +1780,30 @@ } } }, + "owner": { + "type": "object", + "anyOf": [ + { + "required": [ + "email" + ] + }, + { + "required": [ + "name" + ] + } + ], + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "additionalProperties": false + }, "non_additive_dimension": { "type": "object", "required": [ diff --git a/src/generate.py b/src/generate.py new file mode 100644 index 0000000..1e1034d --- /dev/null +++ b/src/generate.py @@ -0,0 +1,19 @@ +import json +import os + +from latest.dbt_yml_files import DbtYmlFiles + +if __name__ == "__main__": + versions = ["latest"] + files = {"dbt_yml_files": DbtYmlFiles} + for v in versions: + output_directory = os.path.join( + os.path.dirname(__file__), "../", f"schemas/{v}-generated" + ) + for file_name, model in files.items(): + file_path = os.path.join( + output_directory, f"{file_name}-{v}-generated.json" + ) + schema = model.model_json_schema(mode="validation") + with open(file_path, "w") as file: + json.dump(schema, file, indent=2) diff --git a/src/latest/dbt_yml_files.py b/src/latest/dbt_yml_files.py new file mode 100644 index 0000000..5ff5dc1 --- /dev/null +++ b/src/latest/dbt_yml_files.py @@ -0,0 +1,1012 @@ +# generated by datamodel-codegen: +# filename: dbt_yml_files-latest.json +# timestamp: 2024-07-25T00:00:09+00:00 + +from __future__ import annotations + +from enum import Enum +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel, ConfigDict, Field, RootModel + + +class Column(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + data_type: Optional[str] = None + + +class Type(Enum): + dashboard = "dashboard" + notebook = "notebook" + analysis = "analysis" + ml = "ml" + application = "application" + + +class Maturity(Enum): + high = "high" + medium = "medium" + low = "low" + + +class Argument(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + type: Optional[str] = None + + +class Access(Enum): + private = "private" + protected = "protected" + public = "public" + + +class Defaults(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + agg_time_dimension: Optional[str] = None + + +class Format(Enum): + csv = "csv" + dict = "dict" + sql = "sql" + + +class ExpectDict(BaseModel): + format: Literal["dict"] = Field("dict") + rows: List[Dict[str, Any]] = Field( + ..., + description="When `format` is `dict`, each item should be a dictionary containing a key-value pair for each column and its value, e.g. `{id: 1, code: 'ABC'}`", + ) + + +class ExpectCSV(BaseModel): + format: Literal["csv"] = Field("csv") + rows: Optional[str] = Field( + None, + description="When `format` is csv or sql, a string containing comma-separated headers and values. Alternatively provide a fixture. Use the pipe character | to create a multi-line string in YAML.", + ) + fixture: Optional[str] = Field( + None, + description="Specify the name of a fixture instead of providing `rows`.", + ) + + +class ExpectSQL(BaseModel): + format: Literal["sql"] = Field("sql") + rows: Optional[str] = Field( + None, + description="When `format` is csv or sql, a string containing comma-separated headers and values. Alternatively provide a fixture. Use the pipe character | to create a multi-line string in YAML.", + ) + fixture: Optional[str] = Field( + None, + description="Specify the name of a fixture instead of providing `rows`.", + ) + + +Expect = Union[ExpectDict, ExpectCSV, ExpectSQL] + + +class GivenItem(BaseModel): + fixture: Optional[str] = Field( + None, + description="Only relevant when format is csv. Specify the name of a fixture instead of providing `rows`.", + ) + format: Optional[Format] = Field( + None, description="Defaults to `dict` when not specified" + ) + input: Optional[str] = Field( + None, + description="The relation whose inputs you need to mock. Enclose in ref or source without curly braces", + examples=[ + "ref('model_b')", + "ref('upstream_project', 'model_b')", + "source('schema', 'table')", + ], + ) + additionalProperties: Optional[Any] = None + + +class Overrides(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + env_vars: Optional[Dict[str, Any]] = None + macros: Optional[Dict[str, Any]] = Field( + None, examples=[{"is_incremental": "true"}] + ) + vars: Optional[Dict[str, Any]] = None + + +class AggregationTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + percentile: Optional[float] = None + use_approximate_percentile: Optional[bool] = None + use_discrete_percentile: Optional[bool] = None + + +class ArrayOfStrings(RootModel[List[str]]): + root: List[str] + + +class Calculation(Enum): + conversions = "conversions" + conversion_rate = "conversion_rate" + CONVERSIONS = "CONVERSIONS" + CONVERSION_RATE = "CONVERSION_RATE" + + +class ConstantProperty(BaseModel): + base_property: str = Field(..., description="DIMENSION or ENTITY") + conversion_property: str = Field(..., description="DIMENSION or ENTITY") + + +class GrainToDate(Enum): + day = "day" + week = "week" + month = "month" + quarter = "quarter" + year = "year" + + +class TimeGranularity(Enum): + DAY = "DAY" + WEEK = "WEEK" + MONTH = "MONTH" + QUARTER = "QUARTER" + YEAR = "YEAR" + day = "day" + week = "week" + month = "month" + quarter = "quarter" + year = "year" + + +class DocsConfig(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + node_color: Optional[str] = Field( + None, + description="The color of the node on the DAG in the documentation. It must be an Hex code or a valid CSS color name.", + pattern="^(#[a-fA-F0-9]{3}|#[a-fA-F0-9]{6}|[^#][a-zA-Z]*)$", + ) + show: Optional[bool] = True + + +class EntityType(Enum): + PRIMARY = "PRIMARY" + UNIQUE = "UNIQUE" + FOREIGN = "FOREIGN" + NATURAL = "NATURAL" + primary = "primary" + unique = "unique" + foreign = "foreign" + natural = "natural" + + +class Entity(BaseModel): + model_config = ConfigDict( + extra="forbid", + regex_engine="python-re", + ) + name: str = Field(..., pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$") + type: EntityType = Field(..., title="Entity Type") + entity: Optional[str] = None + expr: Optional[Union[str, bool]] = None + + +class ExportAs(Enum): + table = "table" + view = "view" + cache = "cache" + + +class ExportConfig(BaseModel): + model_config = ConfigDict( + extra="allow", + ) + alias: Optional[str] = None + export_as: Optional[ExportAs] = None + schema_: Optional[str] = Field(None, alias="schema") + + +class Export(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + config: Optional[ExportConfig] = Field(None, title="Export Config") + + +class Period(Enum): + minute = "minute" + hour = "hour" + day = "day" + + +class GroupName(RootModel[str]): + root: str + + +class JinjaString(RootModel[str]): + root: str = Field(..., pattern="\\{\\{.*\\}\\}") + + +class Agg(Enum): + SUM = "SUM" + MIN = "MIN" + MAX = "MAX" + AVG = "AVG" + COUNT_DISTINCT = "COUNT_DISTINCT" + SUM_BOOLEAN = "SUM_BOOLEAN" + COUNT = "COUNT" + PERCENTILE = "PERCENTILE" + MEDIAN = "MEDIAN" + sum = "sum" + min = "min" + max = "max" + avg = "avg" + count_distinct = "count_distinct" + sum_boolean = "sum_boolean" + count = "count" + percentile = "percentile" + median = "median" + + +class MetricInputMeasure(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: Optional[str] = None + fill_nulls_with: Optional[Union[str, int]] = None + filter: Optional[str] = None + join_to_timespine: Optional[bool] = None + + +class MetricInputSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: Optional[str] = None + alias: Optional[str] = None + filter: Optional[str] = None + offset_window: Optional[str] = None + + +class AuthorizedView(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + database: str + project: str + + +class OnConfigurationChange(Enum): + apply = "apply" + continue_ = "continue" + fail = "fail" + + +class OnSchemaChange(Enum): + append_new_columns = "append_new_columns" + fail = "fail" + ignore = "ignore" + sync_all_columns = "sync_all_columns" + + +class OwnerWithEmail(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + email: str + + +class OwnerWithName(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + + +Owner = Union[OwnerWithEmail, OwnerWithName] + + +class WindowChoice(Enum): + MIN = "MIN" + MAX = "MAX" + min = "min" + max = "max" + + +class NonAdditiveDimension(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + window_choice: Optional[WindowChoice] = None + window_groupings: Optional[List[str]] = None + + +class NumberOrJinjaString(RootModel[Union[JinjaString, float]]): + root: Union[JinjaString, float] + + +class RatioMetricTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + denominator: Optional[MetricInputSchema] = None + filter: Optional[str] = None + numerator: Optional[MetricInputSchema] = None + + +class SimpleMetricTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + measure: Optional[MetricInputMeasure] = None + + +class StringOrArrayOfStrings(RootModel[Union[str, ArrayOfStrings]]): + root: Union[str, ArrayOfStrings] + + +class Severity(Enum): + warn = "warn" + error = "error" + + +class ValidityParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + is_end: Optional[bool] = None + is_start: Optional[bool] = None + + +class Config(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + tags: Optional[StringOrArrayOfStrings] = None + + +class Analyse(BaseModel): + name: str + description: Optional[str] = None + columns: Optional[List[Column]] = None + config: Optional[Config] = None + docs: Optional[DocsConfig] = None + group: Optional[GroupName] = None + + +class Exposure(BaseModel): + name: str + description: Optional[str] = None + type: Type + depends_on: List[str] + label: Optional[str] = None + maturity: Optional[Maturity] = None + meta: Optional[Dict[str, Any]] = None + owner: Owner + tags: Optional[StringOrArrayOfStrings] = None + url: Optional[str] = None + + +class Group(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + owner: Owner + + +class Macro(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + arguments: Optional[List[Argument]] = None + docs: Optional[DocsConfig] = None + + +class SimpleMetricType(Enum): + SIMPLE = "SIMPLE" + simple = "simple" + + +class DerivedMetricType(Enum): + DERIVED = "DERIVED" + derived = "derived" + + +class CumulativeMetricType(Enum): + CUMULATIVE = "CUMULATIVE" + cumulative = "cumulative" + + +class ConversionMetricType(Enum): + CONVERSION = "CONVERSION" + conversion = "conversion" + + +class RatioMetricType(Enum): + RATIO = "RATIO" + ratio = "ratio" + + +class MetricBase(BaseModel): + model_config = ConfigDict( + extra="forbid", + regex_engine="python-re", + ) + name: str = Field(..., pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$") + description: Optional[str] = None + filter: Optional[str] = None + group: Optional[GroupName] = None + label: str + + +class SimpleMetric(MetricBase): + type: SimpleMetricType + type_params: SimpleMetricTypeParams + + +class DerivedMetric(MetricBase): + type: DerivedMetricType + type_params: DerivedMetricTypeParams + + +class CumulativeMetric(MetricBase): + type: CumulativeMetricType + type_params: CumulativeMetricTypeParams + + +class ConversionMetric(MetricBase): + type: ConversionMetricType + type_params: ConversionMetricTypeParams + + +class RatioMetric(MetricBase): + type: RatioMetricType + type_params: RatioMetricTypeParams + + +Metric = Union[ + SimpleMetric, DerivedMetric, CumulativeMetric, ConversionMetric, RatioMetric +] + + +class QueryParams(BaseModel): + dimensions: Optional[ArrayOfStrings] = None + metrics: Optional[ArrayOfStrings] = None + where: Optional[ArrayOfStrings] = None + additionalProperties: Optional[Any] = None + + +class SavedQuery(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: str + exports: Optional[List[Export]] = None + label: str + query_params: QueryParams + + +class UnitTestConfig(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + meta: Optional[Dict[str, Any]] = None + tags: Optional[StringOrArrayOfStrings] = None + + +class UnitTest(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + config: Optional[UnitTestConfig] = Field(None, title="Unit Test Config") + expect: Expect + given: Optional[List[GivenItem]] = None + model: str = Field( + ..., + description="The name of the model whose behaviour you are testing. Does not need to be wrapped in a ref.", + examples=["my_model"], + ) + overrides: Optional[Overrides] = None + additionalProperties: Optional[Any] = None + + +class BooleanOrJinjaString(RootModel[Union[JinjaString, bool]]): + root: Union[JinjaString, bool] + + +class Constraint(BaseModel): + name: Optional[str] = None + type: str + columns: Optional[StringOrArrayOfStrings] = None + expression: Optional[str] = None + warn_unenforced: Optional[BooleanOrJinjaString] = None + warn_unsupported: Optional[BooleanOrJinjaString] = None + + +class Constraints(RootModel[List[Constraint]]): + root: List[Constraint] + + +class ConversionTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + base_measure: MetricInputMeasure + calculation: Optional[Calculation] = Calculation.conversion_rate + constant_properties: Optional[List[ConstantProperty]] = None + conversion_measure: MetricInputMeasure + entity: str = Field(..., description="The entity to calculate over") + window: Optional[str] = None + + +class ConversionMetricTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + conversion_type_params: Optional[ConversionTypeParams] = None + + +class CumulativeMetricTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + grain_to_date: Optional[GrainToDate] = None + measure: Optional[MetricInputMeasure] = None + window: Optional[str] = None + + +class DerivedMetricTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expr: Optional[str] = None + metrics: Optional[List[MetricInputSchema]] = None + + +class DimensionTypeParams(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + time_granularity: TimeGranularity + validity_params: Optional[ValidityParams] = None + + +class FreshnessRules(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + count: NumberOrJinjaString + period: Period + + +class Grants(RootModel[Dict[str, StringOrArrayOfStrings]]): + root: Dict[str, StringOrArrayOfStrings] = Field( + ..., + description="grant config. each key is a database permission and the value is the grantee of that permission", + ) + + +class IncludeExclude(BaseModel): + exclude: Optional[StringOrArrayOfStrings] = None + include: Optional[StringOrArrayOfStrings] = None + + +class Measure(BaseModel): + model_config = ConfigDict( + extra="forbid", + regex_engine="python-re", + ) + name: str = Field(..., pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$") + description: Optional[str] = None + agg: Agg + agg_params: Optional[AggregationTypeParams] = None + agg_time_dimension: Optional[str] = Field( + None, pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$" + ) + create_metric: Optional[bool] = None + create_metric_display_name: Optional[str] = None + expr: Optional[Union[str, int, bool]] = None + label: Optional[str] = None + non_additive_dimension: Optional[NonAdditiveDimension] = None + + +class Contract(BaseModel): + enforced: Optional[BooleanOrJinjaString] = None + + +class ModelConfigs(BaseModel): + auto_refresh: Optional[BooleanOrJinjaString] = None + backup: Optional[BooleanOrJinjaString] = None + contract: Optional[Contract] = None + file_format: Optional[str] = None + grant_access_to: Optional[List[AuthorizedView]] = Field( + None, + description="Configuration, specific to BigQuery adapter, used to setup authorized views.", + title="Authorized views", + ) + grants: Optional[Grants] = None + hours_to_expiration: Optional[float] = Field( + None, + description="Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table.", + ) + kms_key_name: Optional[str] = Field( + None, + description="Configuration of the KMS key name, specific to BigQuery adapter.", + pattern="projects/[a-zA-Z0-9_-]*/locations/[a-zA-Z0-9_-]*/keyRings/.*/cryptoKeys/.*", + ) + labels: Optional[Dict[str, str]] = Field( + None, + description="Configuration specific to BigQuery adapter used to add labels and tags to tables/views created by dbt.", + title="Label configs", + ) + location: Optional[str] = None + materialized: Optional[str] = None + on_configuration_change: Optional[OnConfigurationChange] = None + on_schema_change: Optional[OnSchemaChange] = None + snowflake_warehouse: Optional[str] = None + sql_header: Optional[str] = None + target_lag: Optional[str] = Field( + None, pattern="^(?:downstream|\\d+\\s*(?:seconds|minutes|hours|days))$" + ) + + +class PersistDocsConfig(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + columns: Optional[BooleanOrJinjaString] = Field( + default_factory=lambda: BooleanOrJinjaString.model_validate(True) + ) + relation: Optional[BooleanOrJinjaString] = Field( + default_factory=lambda: BooleanOrJinjaString.model_validate(True) + ) + + +class TestConfigs(BaseModel): + alias: Optional[str] = Field( + None, description="Only relevant when `store_failures` is true" + ) + database: Optional[str] = Field( + None, description="Only relevant when `store_failures` is true" + ) + enabled: Optional[BooleanOrJinjaString] = None + error_if: Optional[str] = None + fail_calc: Optional[str] = None + limit: Optional[float] = None + schema_: Optional[str] = Field( + None, alias="schema", description="Only relevant when `store_failures` is true" + ) + severity: Optional[Union[JinjaString, Severity]] = None + store_failures: Optional[BooleanOrJinjaString] = None + tags: Optional[StringOrArrayOfStrings] = None + warn_if: Optional[str] = None + + +class SnapshotConfig(BaseModel): + alias: Optional[str] = None + check_cols: Optional[StringOrArrayOfStrings] = None + enabled: Optional[BooleanOrJinjaString] = None + grants: Optional[Grants] = None + persist_docs: Optional[PersistDocsConfig] = None + post_hook: Optional[ArrayOfStrings] = Field(None, alias="post-hook") + pre_hook: Optional[ArrayOfStrings] = Field(None, alias="pre-hook") + quote_columns: Optional[BooleanOrJinjaString] = None + strategy: Optional[str] = None + tags: Optional[StringOrArrayOfStrings] = None + target_database: Optional[str] = None + target_schema: Optional[str] = None + unique_key: Optional[StringOrArrayOfStrings] = None + updated_at: Optional[str] = None + + +class Quoting(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + database: Optional[BooleanOrJinjaString] = None + identifier: Optional[BooleanOrJinjaString] = None + schema_: Optional[BooleanOrJinjaString] = Field(None, alias="schema") + + +class Relationships(BaseModel): + name: Optional[str] = None + config: Optional[TestConfigs] = None + field: str = Field( + ..., description="The foreign key column", title="Relationships: Field" + ) + to: str = Field( + ..., examples=["ref('parent_model')", "source('parent_schema', 'parent_table')"] + ) + where: Optional[str] = None + + +class RelationshipsTest(BaseModel): + relationships: Optional[Relationships] = None + + +class AcceptedValues(BaseModel): + name: Optional[str] = None + config: Optional[TestConfigs] = None + quote: Optional[bool] = None + values: List[str] + where: Optional[str] = None + + +class AcceptedValuesTest(BaseModel): + accepted_values: Optional[AcceptedValues] = None + + +class NotNull(BaseModel): + name: Optional[str] = None + config: Optional[TestConfigs] = None + where: Optional[str] = None + + +class NotNullTest(BaseModel): + not_null: Optional[NotNull] = None + + +class Unique(BaseModel): + name: Optional[str] = None + config: Optional[TestConfigs] = None + where: Optional[str] = None + + +class UniqueTest(BaseModel): + unique: Optional[Unique] = None + + +class DataTests( + RootModel[ + Union[str, RelationshipsTest, AcceptedValuesTest, NotNullTest, UniqueTest] + ] +): + root: Union[str, RelationshipsTest, AcceptedValuesTest, NotNullTest, UniqueTest] + + +class DimensionBase(BaseModel): + model_config = ConfigDict( + extra="forbid", + regex_engine="python-re", + ) + name: str = Field(..., pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$") + description: Optional[str] = None + expr: Optional[Union[str, bool]] = None + is_partition: Optional[bool] = None + + +class TimeDimensionType(Enum): + TIME = "TIME" + time = "time" + + +class CategoricalDimensionType(Enum): + CATEGORICAL = "CATEGORICAL" + categorical = "categorical" + + +class CategoricalDimension(DimensionBase): + type: CategoricalDimensionType + + +class TimeDimension(DimensionBase): + type: TimeDimensionType + type_params: DimensionTypeParams + + +class Dimension(RootModel[Union[CategoricalDimension, TimeDimension]]): + root: Union[CategoricalDimension, TimeDimension] + + +class FreshnessDefinition1(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + error_after: Optional[FreshnessRules] = None + filter: Optional[str] = None + warn_after: Optional[FreshnessRules] = None + + +class FreshnessDefinition(RootModel[Union[FreshnessDefinition1, None]]): + root: Union[FreshnessDefinition1, None] + + +class SeedConfig(BaseModel): + column_types: Optional[Dict[str, Any]] = None + copy_grants: Optional[BooleanOrJinjaString] = None + data_tests: Optional[List[DataTests]] = None + database: Optional[str] = None + enabled: Optional[BooleanOrJinjaString] = None + grants: Optional[Grants] = None + quote_columns: Optional[BooleanOrJinjaString] = None + schema_: Optional[str] = Field(None, alias="schema") + + +class SemanticModel(BaseModel): + model_config = ConfigDict( + extra="forbid", + regex_engine="python-re", + ) + name: str = Field(..., pattern="(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$") + description: Optional[str] = None + defaults: Optional[Defaults] = None + dimensions: Optional[List[Dimension]] = None + entities: Optional[List[Entity]] = None + measures: Optional[List[Measure]] = None + model: str + primary_entity: Optional[str] = None + + +class ColumnProperties(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + constraints: Optional[Constraints] = None + data_tests: Optional[List[DataTests]] = None + data_type: Optional[str] = None + meta: Optional[Dict[str, Any]] = None + policy_tags: Optional[List[str]] = Field( + None, + description="Configurations, specific to BigQuery adapter, used to set policy tags on specific columns, enabling column-level security. Only relevant when `persist_docs.columns` is true.", + title="Policy tags", + ) + quote: Optional[BooleanOrJinjaString] = None + tags: Optional[StringOrArrayOfStrings] = None + tests: Optional[List[DataTests]] = None + + +class Version(BaseModel): + columns: Optional[List[Union[IncludeExclude, ColumnProperties]]] = None + config: Optional[ModelConfigs] = None + v: float + + +class Model(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + access: Optional[Access] = None + columns: Optional[List[ColumnProperties]] = None + config: Optional[ModelConfigs] = None + constraints: Optional[Constraints] = None + data_tests: Optional[List[DataTests]] = None + deprecation_date: Optional[str] = None + docs: Optional[DocsConfig] = None + group: Optional[GroupName] = None + latest_version: Optional[float] = None + meta: Optional[Dict[str, Any]] = None + tests: Optional[List[DataTests]] = None + versions: Optional[List[Version]] = None + + +class Seed(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + columns: Optional[List[ColumnProperties]] = None + config: Optional[SeedConfig] = Field(None, title="Seed Config") + docs: Optional[DocsConfig] = None + group: Optional[GroupName] = None + tests: Optional[List[DataTests]] = None + + +class Snapshot(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str + description: Optional[str] = None + columns: Optional[List[ColumnProperties]] = None + config: Optional[SnapshotConfig] = Field(None, title="Snapshot Config") + data_tests: Optional[List[DataTests]] = None + docs: Optional[DocsConfig] = None + group: Optional[GroupName] = None + meta: Optional[Dict[str, Any]] = None + tests: Optional[List[DataTests]] = None + + +class Table(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + name: str = Field( + ..., + description="How you will identify the table in {{ source() }} calls. Unless `identifier` is also set, this will be the name of the table in the database.", + title="Name", + ) + description: Optional[str] = None + columns: Optional[List[ColumnProperties]] = None + external: Optional[Dict[str, Any]] = None + freshness: Optional[FreshnessDefinition] = None + identifier: Optional[str] = Field( + None, + description="The table name as stored in the database. Only needed if you want to give the source a different name than what exists in the database (otherwise `name` is used by default)", + title="Identifier", + ) + loaded_at_field: Optional[str] = Field( + None, + description="Which column to check during data freshness tests. Only needed if the table has a different loaded_at_field to the one defined on the source overall.", + ) + loader: Optional[str] = None + meta: Optional[Dict[str, Any]] = None + quoting: Optional[Quoting] = None + tags: Optional[StringOrArrayOfStrings] = None + tests: Optional[List[DataTests]] = None + + +class Source(BaseModel): + name: str = Field( + ..., + description="How you will identify the schema in {{ source() }} calls. Unless `schema` is also set, this will be the name of the schema in the database.", + ) + description: Optional[str] = None + config: Optional[Dict[str, Any]] = None + data_tests: Optional[List[DataTests]] = None + database: Optional[str] = None + freshness: Optional[FreshnessDefinition] = None + loaded_at_field: Optional[str] = None + loader: Optional[str] = None + meta: Optional[Dict[str, Any]] = None + overrides: Optional[str] = Field( + None, + description="The name of another package installed in your project. If that package has a source with the same name as this one, its properties will be applied on top of the base properties of the overridden source. https://docs.getdbt.com/reference/resource-properties/overrides", + title="Package to Override", + ) + quoting: Optional[Quoting] = None + schema_: Optional[str] = Field( + None, + alias="schema", + description="The schema name as stored in the database. Only needed if you want to use a different `name` than what exists in the database (otherwise `name` is used by default)", + ) + tables: Optional[List[Table]] = None + tags: Optional[StringOrArrayOfStrings] = None + tests: Optional[List[DataTests]] = None + + +class DbtYmlFiles(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + version: Literal[2] = 2 + analyses: Optional[List[Analyse]] = None + exposures: Optional[List[Exposure]] = None + groups: Optional[List[Group]] = None + macros: Optional[List[Macro]] = None + metrics: Optional[List[Metric]] = None + models: Optional[List[Model]] = None + saved_queries: Optional[List[SavedQuery]] = None + seeds: Optional[List[Seed]] = None + semantic_models: Optional[List[SemanticModel]] = None + snapshots: Optional[List[Snapshot]] = None + sources: Optional[List[Source]] = None + unit_tests: Optional[List[UnitTest]] = None diff --git a/tests/latest/valid/dbt_yml_files.yml b/tests/latest/valid/dbt_yml_files.yml index 1b07fe1..7ec00a4 100644 --- a/tests/latest/valid/dbt_yml_files.yml +++ b/tests/latest/valid/dbt_yml_files.yml @@ -289,3 +289,28 @@ saved_queries: alias: my_export_alias export_as: table schema: my_export_schema_name + + +sources: + - name: jaffle_shop + database: raw + + freshness: # default freshness + warn_after: {count: 12, period: hour} + error_after: {count: 24, period: hour} + + loaded_at_field: _etl_loaded_at + + tables: + - name: customers # this will use the freshness defined above + + - name: orders + freshness: # make this a little more strict + warn_after: {count: 6, period: hour} + error_after: {count: 12, period: hour} + # Apply a where clause in the freshness query + filter: datediff('day', _etl_loaded_at, current_timestamp) < 2 + + + - name: product_skus + freshness: # do not check freshness for this table \ No newline at end of file