-
Notifications
You must be signed in to change notification settings - Fork 134
Description
Describe the bug
When compiling the log function is called when it should be skipped. This causes an extra log entry to be created when compiling any model that might call the stage_external_tables macro. There aren't any sources available during compile time. The macro shouldn't log that. It is expected.
Steps to reproduce
Add the stage_external_tables macro to a pre-hook, analysis, or other file that will cause an execution during compile time.
Expected results
No log entries should be written during compile.
Actual results
A log entry is created for each time the macro is referenced in a file.
Which database are you using dbt with?
- redshift
- snowflake
- other (specify: BigQuery)
The output of dbt --version
:
Core:
- installed: 1.8.4
- latest: 1.8.4 - Up to date!
Plugins:
- bigquery: 1.8.2 - Up to date!
The operating system you're using:
macOs 14.5
The output of python --version
:
Python 3.11.9
Additional context
I believe that we can change line 36 in the stage_external_tables to fix the issue.
Existing code
{% if sources_to_stage|length == 0 %}
Proposed change
{% if sources_to_stage|length == 0 and execute %}