mert_bakir
06/01/2023, 9:35 PMmert_bakir
06/02/2023, 11:49 AMvisch
06/02/2023, 12:33 PMmert_bakir
06/02/2023, 12:48 PMmert_bakir
06/02/2023, 12:49 PMvisch
06/02/2023, 12:49 PMmert_bakir
06/02/2023, 12:54 PMthomas_briggs
06/02/2023, 1:10 PMmert_bakir
06/02/2023, 4:45 PMthomas_briggs
06/02/2023, 4:51 PM{% macro create_batched_at_index(tableName) %}
{% set sql %}
CREATE INDEX IF NOT EXISTS {{ tableName|lower }}_batched_at ON <your-schema>."{{ tableName|lower }}"(_sdc_batched_at)
{% endset %}
{% do run_query(sql) %}
{% do log("Ensured existence of batched_at index on " ~ tableName, info=True) %}
{% endmacro %}
and then in a model that uses that table, include
{{ config(
...
pre_hook = "{{ create_batched_at_index('<raw-table>') }}",
...
)
}}
thomas_briggs
06/02/2023, 4:52 PMthomas_briggs
06/02/2023, 4:53 PMmert_bakir
06/02/2023, 5:09 PMmert_bakir
06/04/2023, 7:38 PM19:35:37 Running with dbt=1.5.1
19:35:40 Ensured existence of batched_at and deleted_at indexes on xyz
19:35:45 Found 208 models, 482 tests, 0 snapshots, 0 analyses, 654 macros, 0 operations, 5 seed files, 112 sources, 0 exposures, 0 metrics, 0 groups
19:35:45
19:35:45 Concurrency: 4 threads (target='....')
19:35:45
19:35:45 1 of 32 START sql view model --- .............. [RUN]
19:35:45 2 of 32 START sql view model --- ................. [RUN]
19:35:45 3 of 32 START sql view model --- .................. [RUN]
19:35:45 4 of 32 START sql view model xyz ............ [RUN]
19:35:46 Ensured existence of batched_at and deleted_at indexes on xyz
mert_bakir
06/04/2023, 8:28 PM{% if execute %}
{% do run_query(sql) %}
{% do log("Ensured existence of batched_at and deleted_at indexes on " ~ schema_name ~ table_name, info=True) %}
{% endif %}