From 7f89db6c59023cb59ef9dface64efe827ede382a Mon Sep 17 00:00:00 2001 From: Joel Labes Date: Wed, 25 Sep 2024 15:01:10 +1200 Subject: [PATCH 1/2] Allow config blocks in sources' tables, add event_time --- schemas/latest/dbt_yml_files-latest.json | 10 ++++++++++ tests/latest/valid/dbt_yml_files.yml | 24 ++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/schemas/latest/dbt_yml_files-latest.json b/schemas/latest/dbt_yml_files-latest.json index 4c9cce3..853286c 100644 --- a/schemas/latest/dbt_yml_files-latest.json +++ b/schemas/latest/dbt_yml_files-latest.json @@ -820,6 +820,16 @@ "$ref": "#/$defs/column_properties" } }, + "config": { + "type": "object", + "properties": { + "event_time": { + "type": "string", + "description": "The column that represents the actual moment the row's event happened. Contrast with, for example, when it was loaded to the warehouse." + }, + "additionalProperties": true + } + }, "data_tests": { "type": "array", "items": { diff --git a/tests/latest/valid/dbt_yml_files.yml b/tests/latest/valid/dbt_yml_files.yml index 4072930..a306422 100644 --- a/tests/latest/valid/dbt_yml_files.yml +++ b/tests/latest/valid/dbt_yml_files.yml @@ -1,5 +1,3 @@ -# this file was generated with dbt init with dbt 1.2.1 - models: - name: my_first_dbt_model description: "A starter dbt model" @@ -298,3 +296,25 @@ saved_queries: alias: my_export_alias export_as: table schema: my_export_schema_name + + +sources: + - name: some_source_name + loaded_at_field: _etl_loaded_at + freshness: + error_after: + count: 2 + period: day + warn_after: + count: 1 + period: day + tables: + - name: some_table_name + config: + event_time: "created_at" + - name: another_table_name + columns: + - name: my_unique_column + description: This sure is a column + data_tests: + - unique \ No newline at end of file From 55a7034bd174d1707636b8b9653645c14bdeb61c Mon Sep 17 00:00:00 2001 From: Joel Labes Date: Mon, 30 Sep 2024 15:52:00 +1300 Subject: [PATCH 2/2] Add event_time for models too --- schemas/latest/dbt_yml_files-latest.json | 4 ++++ tests/latest/valid/dbt_yml_files.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/schemas/latest/dbt_yml_files-latest.json b/schemas/latest/dbt_yml_files-latest.json index 853286c..631dda2 100644 --- a/schemas/latest/dbt_yml_files-latest.json +++ b/schemas/latest/dbt_yml_files-latest.json @@ -1835,6 +1835,10 @@ } } }, + "event_time": { + "type": "string", + "description": "The column that represents the actual moment the row's event happened. Contrast with, for example, when it was loaded to the warehouse." + }, "file_format": { "type": "string" }, diff --git a/tests/latest/valid/dbt_yml_files.yml b/tests/latest/valid/dbt_yml_files.yml index a306422..8c8fc74 100644 --- a/tests/latest/valid/dbt_yml_files.yml +++ b/tests/latest/valid/dbt_yml_files.yml @@ -32,6 +32,7 @@ models: config: contract: enforced: true + event_time: "created_at" columns: - name: id description: "The primary key for this table"