Velir / dbt-ga4

dbt Package for modeling raw data exported by Google Analytics 4. BigQuery support, only.
MIT License
290 stars 129 forks source link

fix code getting accidentally commented out #228

Closed dgitis closed 1 year ago

dgitis commented 1 year ago

Description & motivation

Something in how dbt processes macros in pre-hooks causes code without line breaks to appear on a single line in production but not development. This results in code that we want getting commented out when there isn't a blank line after the comment, but only in production.

This results in the following code running in production on dbt Cloud.

    -- If incremental, then use static_incremental_days variable to find earliest shard to copyCREATE OR REPLACE TABLE `project.dataset.events_intraday_20230530snip1` CLONE `project.dataset.events_intraday_20230530`;

This PR results in something like this code running.

    -- If incremental, then use static_incremental_days variable to find earliest shard to copy

                    CREATE OR REPLACE TABLE `project.dataset.events_intraday_20230530snip1` CLONE `project.dataset.events_intraday_20230530snip2`;

Checklist

adamribaudo-velir commented 1 year ago

I can clarify. Using {%- will remove whitespace generated by the jinja script while {% will include the literal whitespace used inside the jinja script.

Let me make that change, commit, and @dgitis please retest

adamribaudo-velir commented 1 year ago

all set

dgitis commented 1 year ago

I tried that but only removing the ticks from the jinja immediately surrounding the clone statements and it didn't do anything but this latest version with the changes that you made worked, albeit with a lot of whitepace between the comment and the clone statement.

dgitis commented 1 year ago

I seem to have started branch behind by a few commits. This should be ready to merge now @adamribaudo-velir .