Manipulate string in DBT’s macro with Jinja2
I am trying to create a dbt macro that can load a table from the macro’s arguments. I can do it when I specify input directly, e.g.: ref('data_categories')
(data_categories
is a real table name). However, my problem occurs when manipulating the string to pass to ref
. Below are my error function and an error during compiling time.
How to insert data into same row using pre-hook and post-hook in dbt?
I am writing a pre hook and a post-hook for my dbt models to create a table with details of my models like execution time etc, what i would like to know is how to ensure that the values are inserted in the same row. i am using insert command in my pre-hook and update command in post-hook. however i am having trouble in adding them to the same row. i cannot use model name as the primary key because i may run each model multiple times. so i created a self incremental column called key which is to be my primary key. so how do i collect the key column value from the pre hook and use it in the post hook?.
Documentation on dbt tests not generated at dbt docs
I am trying to provide documentation for a dbt tests.
I have created a test validating the sum of 2 numbers (of course, this is just an example).
how to pass a variable from one macro to another in pre_hook
I have macros get_date
How to pass variable while calling macros in pre hook
I have a variable and I want to pass it to a macros, I call the macros itself in pre_Hook
Writing if statement with environment variable in dbt
I am trying to use environment variables in an if statement in dbt jinja.