Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data tests #125

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions schemas/latest/dbt_project-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"config-version": {
"type": "number",
"default": 2
},
"data_tests": {
"$ref": "#/$defs/data_test_configs"
},
"dbt-cloud": {
"type": "object",
Expand Down
278 changes: 154 additions & 124 deletions schemas/latest/dbt_yml_files-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@
"constraints": {
"$ref": "#/$defs/constraints"
},
"data_tests": {
"type": "array",
"items": {
"$ref": "#/$defs/data_tests"
}
},
"docs": {
"$ref": "#/$defs/docs_config"
},
Expand All @@ -299,7 +305,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
},
"versions": {
Expand Down Expand Up @@ -365,6 +371,12 @@
"copy_grants": {
"$ref": "#/$defs/boolean_or_jinja_string"
},
"data_tests": {
"type": "array",
"items": {
"$ref": "#/$defs/data_tests"
}
},
"database": {
"type": "string"
},
Expand All @@ -391,7 +403,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
}
},
Expand Down Expand Up @@ -519,6 +531,12 @@
}
}
},
"data_tests": {
"type": "array",
"items": {
"$ref": "#/$defs/data_tests"
}
},
"docs": {
"$ref": "#/$defs/docs_config"
},
Expand All @@ -531,7 +549,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
}
},
Expand All @@ -556,6 +574,12 @@
"config": {
"type": "object"
},
"data_tests": {
"type": "array",
"items": {
"$ref": "#/$defs/data_tests"
}
},
"database": {
"type": "string"
},
Expand Down Expand Up @@ -659,7 +683,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
}
},
Expand All @@ -672,7 +696,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
}
}
Expand Down Expand Up @@ -807,7 +831,7 @@
}
},
"model": {
"description": "The name of the model whose behaviour you are testing. Does not need to wrapped in a ref.",
"description": "The name of the model whose behaviour you are testing. Does not need to be wrapped in a ref.",
"type": "string",
"examples": [
"my_model"
Expand Down Expand Up @@ -889,6 +913,12 @@
"constraints": {
"$ref": "#/$defs/constraints"
},
"data_tests": {
"type": "array",
"items": {
"$ref": "#/$defs/data_tests"
}
},
"data_type": {
"type": "string"
},
Expand All @@ -912,7 +942,7 @@
"tests": {
"type": "array",
"items": {
"$ref": "#/$defs/tests"
"$ref": "#/$defs/data_tests"
}
}
},
Expand Down Expand Up @@ -947,6 +977,123 @@
}
}
},
"data_tests": {
"anyOf": [
{
"type": "string"
},
{
"title": "Relationships Test",
"type": "object",
"properties": {
"relationships": {
"type": "object",
"required": [
"to",
"field"
],
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"field": {
"title": "Relationships: Field",
"description": "The foreign key column",
"type": "string",
"default": "<FOREIGN_KEY_COLUMN>"
},
"to": {
"type": "string",
"default": "ref('')",
"examples": [
"ref('parent_model')",
"source('parent_schema', 'parent_table')"
]
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Accepted Values Test",
"type": "object",
"properties": {
"accepted_values": {
"type": "object",
"required": [
"values"
],
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"quote": {
"type": "boolean"
},
"values": {
"type": "array",
"items": {
"type": "string"
}
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Not Null Test",
"type": "object",
"properties": {
"not_null": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Unique Test",
"type": "object",
"properties": {
"unique": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"where": {
"type": "string"
}
}
}
}
}
]
},
"dimension": {
"type": "object",
"required": [
Expand Down Expand Up @@ -1526,123 +1673,6 @@
}
}
},
"tests": {
"anyOf": [
{
"type": "string"
},
{
"title": "Relationships Test",
"type": "object",
"properties": {
"relationships": {
"type": "object",
"required": [
"to",
"field"
],
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"field": {
"title": "Relationships: Field",
"description": "The foreign key column",
"type": "string",
"default": "<FOREIGN_KEY_COLUMN>"
},
"to": {
"type": "string",
"default": "ref('')",
"examples": [
"ref('parent_model')",
"source('parent_schema', 'parent_table')"
]
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Accepted Values Test",
"type": "object",
"properties": {
"accepted_values": {
"type": "object",
"required": [
"values"
],
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"quote": {
"type": "boolean"
},
"values": {
"type": "array",
"items": {
"type": "string"
}
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Not Null Test",
"type": "object",
"properties": {
"not_null": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"where": {
"type": "string"
}
}
}
}
},
{
"title": "Unique Test",
"type": "object",
"properties": {
"unique": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"config": {
"$ref": "#/$defs/test_configs"
},
"where": {
"type": "string"
}
}
}
}
}
]
},
"validity_params": {
"type": "object",
"properties": {
Expand Down
Loading