dbt should have a Dry-Run mode #4456
Replies: 33 comments 12 replies
-
So, I took a look at I can see that the In case it's helpful to see where my head is going, the way I've implemented this in the past is to have two functions for executing SQL. One for commands (no results returned) and one for queries (returning data) -- this way your read and write operations are split. Then, for the dry-run mode, you can put some logic in the command-handling function that just logs the command instead of passing it to
|
Beta Was this translation helpful? Give feedback.
-
yes, I vote to have the dry-run feature, which will be super helpful for debug and performance tuning |
Beta Was this translation helpful? Give feedback.
-
@cmcarthur What's the reasoning for this to be removed from the milestone? |
Beta Was this translation helpful? Give feedback.
-
Hi @thalesmello - this is a pretty involved change to dbt! Connor and I tried to prioritize it for the Wilt Chamberlain release (0.14.0), but we ended up deciding to cull it in favor of Archive-related functionality. This feature is definitely going to be a big improvement to dbt - I'm looking forward to re-prioritizing it! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the explanation @drewbanin 👍 |
Beta Was this translation helpful? Give feedback.
-
+1 as well to adding a dry run feature such as a |
Beta Was this translation helpful? Give feedback.
-
Any movement on this? |
Beta Was this translation helpful? Give feedback.
-
Hello everyone! |
Beta Was this translation helpful? Give feedback.
-
@giovanni-girelli-sdg To see the actual SQL that dbt will execute you can use |
Beta Was this translation helpful? Give feedback.
-
Hi @alepuccetti! thanks for the reply, but there you can only see the SELECT statement. What I'd like to see is the actual SQL that will run, such as a MERGE, INSERT or CREATE statement. Edit at least it's what I can find. Is there a way to see the full materialization code? Edit2: I had not seen the target/run folder, that's enough for debugging in DEV. I still think it would be great to be able to have a dry run mode where no sql is actually executed, but I can see how that would be much harder to do. Thanks for the great work! |
Beta Was this translation helpful? Give feedback.
-
@mikekaminsky you opened this on my birthday! |
Beta Was this translation helpful? Give feedback.
-
+1 to this, especially if it allowed the calculation of the cost of the run, and allowed prevention of the run if the cost was too high unless a --force argument was used. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, this is what I came up with locally, which extracts the In this case
poetry run dbt compile --select your_model \
&& jq -r '.nodes."model.your_project.your_model".config.sql_header' < target/manifest.json > tmp.sql \
&& cat target/compiled/your_project/models/your_directory/your_model.sql >> tmp.sql \
&& clipboard tmp.sql |
Beta Was this translation helpful? Give feedback.
-
This would be useful for our dbt dry runner which evaluates wether a dbt project will be run. We had to get around not having the full |
Beta Was this translation helpful? Give feedback.
-
I've logged a similarly-named-but-different proposal proposal here, FYI: Difference in that proposal is to still allow all the code to "execute" or "compile" in the SQL backend, but to do so without the cost of moving or transforming data. |
Beta Was this translation helpful? Give feedback.
-
+1 for DryRun! |
Beta Was this translation helpful? Give feedback.
-
+1 to fully understand the plan details of the |
Beta Was this translation helpful? Give feedback.
-
+1 for dry run. I hosed a prod database during a dbt migration today because dbt redshift 1.6 didn't render my custom schemas as expected. A command to validate my schemas are correct before building would have saved me a lot of time. |
Beta Was this translation helpful? Give feedback.
-
+1 for dry run. |
Beta Was this translation helpful? Give feedback.
-
+1 for dry run |
Beta Was this translation helpful? Give feedback.
-
+1 for dry run |
Beta Was this translation helpful? Give feedback.
-
for those that haven't seen, in v1.8 there is the |
Beta Was this translation helpful? Give feedback.
-
+1 for dry run |
Beta Was this translation helpful? Give feedback.
-
Give us a `dbt compile` command that is equivalent to sdf compile and we don't ever need a dry run.
Thanks,
Daniel
…________________________________
From: Romulo Carvalho ***@***.***>
Sent: Monday, March 24, 2025 9:18:57 PM
To: dbt-labs/dbt-core ***@***.***>
Cc: Daniel Bartley ***@***.***>; Comment ***@***.***>
Subject: Re: [dbt-labs/dbt-core] dbt should have a Dry-Run mode (Discussion #4456)
@oakromulo<https://github.com/oakromulo> could you please elaborate on why it's still not an option? Is it because of performance issues - we waste time creating 0 rows views/tables or something else? Currently, my company is also thinking about adding dry-run as a part of our CI/CD and I stumbled upon your comment. I'd like to understand better your perspective
it's not an option in sensitive scenarios in which you deliberately don't want any tables/views/schemas being created or replaced at all but you would still like to see target/run code for it, i.e. the exact statements dbt would try to run against the target warehouse without actually running them
—
Reply to this email directly, view it on GitHub<#4456 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLXPTKIN2NCT3GDQPR3LRD2V7LZDAVCNFSM6AAAAABZPPEGKCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENRQGAZTMMA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I was desperately needing it, so I created a pretty simple bash script, which looks at the compiled models in target would be great to have dry-run in dbt of course. |
Beta Was this translation helpful? Give feedback.
-
Seems like there are two distinct ideas of a dry run that folks are talking about here. Namely, one which validates query syntax and identifiers and another which would simply output the full DDL / DML statements produced by DBT. Interestingly enough, the SQLAdapter base class defines a From docstring:
The Bigquery Adapter which our shop uses actually overrides this method to use the platform specific dry run flag when submitting a query with this method. As far as I can tell though, this method is unused outside of the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
DBT should have a dry-run mode
Feature description
DBT should have a dry-run mode so that users can see all of the "commands" DBT will run for a given command without having DBT actually execute those commands against a database.
Who will this benefit?
This can be useful for both debugging as well as making sure that a given command is configured properly. This is especially useful when you're configuring a production setup and want to make sure you're not about to drop schemas or tables you didn't intend to.
It can also be useful for testing macros and other DBT configurations that are post-compilation but don't show up in the compiled SQL
Beta Was this translation helpful? Give feedback.
All reactions