diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_base.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_base.sql index a92ac96c..1213403a 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_base.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_base.sql @@ -18,6 +18,8 @@ WHERE event_unstruct.contexts IS NOT NULL AND context.value:schema::STRING != 'iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0' + -- limit to last 6 months for performance purposes + AND event_unstruct.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) {% if is_incremental() %} diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_cli.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_cli.sql index c0cccb9c..90bac77a 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_cli.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_cli.sql @@ -15,6 +15,7 @@ WITH base_1_0_0 AS ( MAX(SPLIT_PART(schema_name, '/', -1)) AS schema_version FROM {{ ref('context_base') }} WHERE schema_name = 'iglu:com.meltano/cli_context/jsonschema/1-0-0' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 ), @@ -51,6 +52,7 @@ base_1_1_0_onward AS ( WHERE schema_name LIKE 'iglu:com.meltano/cli_context/%' AND schema_name != 'iglu:com.meltano/cli_context/jsonschema/1-0-0' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 ) diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_environment.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_environment.sql index 378a200e..0e4a5622 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_environment.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_environment.sql @@ -39,6 +39,7 @@ WITH base AS ( FROM {{ ref('context_base') }} WHERE schema_name LIKE 'iglu:com.meltano/environment_context/%' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 ) diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_exception.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_exception.sql index 60b971d2..b5a74c23 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_exception.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_exception.sql @@ -15,6 +15,7 @@ WITH base AS ( FROM {{ ref('context_base') }} WHERE schema_name LIKE 'iglu:com.meltano/exception_context/%' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 ) diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_identify.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_identify.sql index 63418176..7a5e0f49 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_identify.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_identify.sql @@ -19,6 +19,7 @@ WITH base AS ( FROM {{ ref('context_base') }} WHERE schema_name LIKE 'iglu:com.meltano/identify_context/%' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 ) diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_plugins.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_plugins.sql index 98bd88c9..4d14987d 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_plugins.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_plugins.sql @@ -15,6 +15,7 @@ WITH base AS ( FROM {{ ref('context_base') }} WHERE schema_name LIKE 'iglu:com.meltano/plugins_context/%' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) ), diff --git a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_project.sql b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_project.sql index 86fde37b..7e338c3b 100644 --- a/data/transform/models/marts/telemetry/base/unstructured_parsing/context_project.sql +++ b/data/transform/models/marts/telemetry/base/unstructured_parsing/context_project.sql @@ -28,6 +28,7 @@ WITH base AS ( FROM {{ ref('context_base') }} WHERE schema_name LIKE 'iglu:com.meltano/project_context/%' + AND context_base.event_created_at::DATE > DATEADD(MONTH, -6, CURRENT_DATE()) GROUP BY 1 )