[Python] How to run a test in DBT with a specific time?

Discussão em 'Python' iniciado por Stack, Novembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I'm setting up a test in DBT (I use the 1.4 version) and I need it to only run after a specific time in UTC format (05:00). To do this, I am using the enabled attribute in schema.yml with conditional logic based on the now() function. The idea is that the test will only be activated after 05:00AM UTC.

    My current configuration looks like this:

    version: 2
    models:
    - name: my_first_model
    tests:
    - my_first_model_test:
    name: my_first_model_test
    config:
    enabled: "{{ 'true' if (now()..hour >= 5) else 'false' }}"


    My question is: is this no enabled logic valid in DBT? Does enabled accept Jinja expressions like this? If it is not valid, what would be the best way to condition the execution of a test in DBT based on time?

    Continue reading...

Compartilhe esta Página