Search code examples
crondbt

How to run dbt from Crontab in Ubuntu?


I want to create a Cron job that runs DBT https://www.getdbt.com/ on the schedule. Normally, I run it in a virtual environment with dbt run command in a dbt folder.

I've created the cron job in crontab

12 11 * * * cd ~/path/to/dbt-folder && ~/path/to/.venv/python dbt run 

And it's not working.

Can someone provide some help on how to configure DBT job in crontab?

Thanks


Solution

  • You need to use the dbt binary directly, your cron should look something like this

    12 11 * * * cd ~/path/to/dbt-folder && ~/path/to/.venv/bin/dbt run