Marco de Nijs
12/28/2023, 8:32 PM20:28:43 on-run-end failed, error:
20:28:43 dbt was unable to infer all dependencies for the model "actiefwerk_dbt-on-run-end-0".
20:28:43 This typically happens when ref() is placed within a conditional block.
20:28:43
20:28:43 To fix this, add the following hint to the top of the model "actiefwerk_dbt-on-run-end-0":
20:28:43
20:28:43 -- depends_on: {{ ref('dbt_results') }}
While 'ofcourse' the --depends on is present like in the example.Ella Katz
12/31/2023, 4:19 PMMarco de Nijs
12/31/2023, 7:29 PMOr Avidov
01/01/2024, 7:39 AMdbt_project.yml and dbt.log?
Regardless, what Ella meant is that you can save all the trouble and time by just downloading our dbt package as it does this already (and much more) and it's much more battle tested (was tested across all platforms and many different dbt versions for example). Is there any reason why you don't want to go down that path?Marco de Nijs
01/01/2024, 9:43 PMMarco de Nijs
01/01/2024, 9:43 PM# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'actiefwerk_dbt'
version: '1.0.0'
config-version: 2
vars:
dbt_date:time_zone: "Europe/Amsterdam"
# This setting configures which "profile" dbt uses for this project.
profile: 'default'
# These configurations specify where dbt should look for different types of files.
`# The source-paths config, for example, states that models in this project can be`
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]
target-path: "target" # directory which will store compiled SQL files
`clean-targets: # directories to be removed by `dbt clean``
- "target"
- "dbt_packages"
quoting:
database: false
schema: false
identifier: false
# Configuring models
# Full documentation: <https://docs.getdbt.com/docs/configuring-models>
models:
actiefwerk_dbt:
staging:
+materialized: view
+database: "{{ env_var('DBT_STAGING') }}"
dwh:
+materialized: table
+database: "{{ env_var('DBT_DWH') }}"
on-run-end:
- "{{ log_dbt_results(results) }}"Marco de Nijs
01/01/2024, 9:45 PMOfek Weiss
01/08/2024, 9:22 AMref function is not available in on-run-end hooks drop sad
You have two solutions:
⢠if this is strictly for poc reasons, you can just reference it explicitly - (database.schema.dbt_results instead of {{ ref('dbt_results' }})
⢠if not, you can write a macro to find the "ref" of this model, you can see how we do it in our package here
either way, remove the --depends-on comment from your log_dbt_results macroMarco de Nijs
01/18/2024, 7:04 PMOfek Weiss
01/18/2024, 8:56 PM