<@U088WCP3B4P> Is `dbt run -s elementary` an opera...
# ask-elementary-ai
j
@kapa.ai Is
dbt run -s elementary
an operation that should be run regularly during our daily pipelines or is it a one time operation that should only be run a single time and never after? Explain the advantages and disadvantages of each approach.
k
A message from kapa.ai
dbt run -s elementary
is generally a one-time operation that should be run during the initial setup of Elementary in each environment (dev, staging, prod), and again only when you upgrade the Elementary dbt package to a new minor version (e.g., 0.6.x to 0.7.x). The main purpose of this command is to create or update the Elementary tables and views in your data warehouse, especially when there are schema changes introduced by a new version of the package. After this, the ongoing data collection and updates are handled automatically by on-run-end hooks, so you do not need to run this command as part of your daily pipelines [When to run dbt run -s elementary](https://slack.com/archives/C02CTC89LAX/p1685412868454149) [Clarification on regular runs](https://slack.com/archives/C02CTC89LAX/p1711543686145199) [Setup and upgrades](https://slack.com/archives/C02CTC89LAX/p1677879115067759). ### Advantages and Disadvantages #### Running Regularly (Daily Pipelines) Advantages: - Ensures that any schema changes are immediately applied if you happen to upgrade the package without realizing it. - No harm is done if you run it more than needed; it simply ensures your models are up to date, but does not negatively impact your data or pipeline [Harmless to run more than once](https://slack.com/archives/C02CTC89LAX/p1667989628533409). Disadvantages: - Unnecessary resource usage: Running the command daily can consume compute and time, even though no changes are needed most of the time. - Can clutter logs and make pipeline runs slightly longer without any real benefit. #### Running Once (Initial Setup and Upgrades Only) Advantages: - Efficient: Only runs when needed, saving compute resources and time. - Clean pipeline: Less noise in logs and fewer unnecessary operations. Disadvantages: - If you forget to run it after a package upgrade, you may encounter errors due to missing schema changes. However, this is easily mitigated by including it as a step in your upgrade process. ### Summary Best practice: Run
dbt run -s elementary
once per environment during initial setup and after each minor version upgrade of the Elementary package. There is no need to run it as part of your daily pipelines, but doing so will not cause harm—it's just unnecessary in most cases [Official guidance](https://slack.com/archives/C02CTC89LAX/p1681828547502659) [CI/CD recommendations](https://slack.com/archives/C02CTC89LAX/p1668088517905629).