ποΈ adapter
Your database communicates with dbt using an internal database adapter object. For example, BaseAdapter and SnowflakeAdapter. The Jinja object adapter is a wrapper around this internal database adapter object.
ποΈ as_bool
The as_bool Jinja filter will coerce Jinja-compiled output into a boolean
ποΈ as_native
The as_native Jinja filter will coerce Jinja-compiled output into its
ποΈ as_number
The as_number Jinja filter will coerce Jinja-compiled output into a numeric
ποΈ as_text
The as_text Jinja filter will coerce Jinja-compiled output back to text. It
ποΈ builtins
New in 0.16.0
ποΈ config
Overview
ποΈ cross-database macros
Overview
ποΈ dbt_project.yml Context
The compilation context of the dbt_project.yml file is well-defined as
ποΈ dbt_version
New in 0.16.0
ποΈ debug
The debug macro is new in dbt v0.14.1, and is only intended to be used in a development context with dbt. Do not deploy code to production which uses the debug macro.
ποΈ dispatch
- v1.0.0: The 'packages' argument is fully deprecated. Use macro_namespace and project-level dispatch config instead.
ποΈ doc
The doc function is used to reference docs blocks in the description field of schema.yml files. It is analogous to the ref function. For more information, consult the Documentation guide.
ποΈ env_var
The envvar function can be used to incorporate Environment Variables from the system into your dbt project. This envvar function can be used in your profiles.yml file, the dbtproject.yml file, the sources.yml file, your schema.yml files, and in model .sql files. Essentially envvar is available anywhere dbt processes jinja code.
ποΈ exceptions
The exceptions namespace can be used to raise warnings and errors in dbt userspace.
ποΈ execute
execute is a Jinja variable that returns True when dbt is in "execute" mode.
ποΈ flags
The flags variable contains values of flags provided on the command line.
ποΈ fromjson
The fromjson context method can be used to deserialize a json string into a Python object primitive, eg. a dict or list.
ποΈ fromyaml
The fromyaml context method can be used to deserialize a yaml string into a Python object primitive, eg. a dict or list.
ποΈ graph
The graph context variable contains information about the nodes in your dbt
ποΈ invocation_id
The invocation_id outputs a UUID generated for this dbt command. This value is
ποΈ local_md5
The localmd5 context variable calculates an MD5 hash of the given string. The string localmd5 emphasizes that the hash is calculated locally, in the dbt-Jinja context. This variable is typically useful for advanced use cases. For example, when you generate unique identifiers within custom materialization or operational logic, you can either avoid collisions between temporary relations or identify changes by comparing checksums.
ποΈ log
Args:
ποΈ model
model is the dbt graph object (or node) for the current model. It can be used to:
ποΈ modules
The modules variable in the Jinja context contains useful Python modules for operating on data.
ποΈ on-run-end Context
These variables are only available in the context for on-run-end hooks. They will evaluate to none if used outside of an on-run-end hook!
ποΈ print
About print
ποΈ profiles.yml Context
The following context variables and methods are available when configuring
ποΈ project_name
New in 0.16.0
ποΈ ref
Overview
ποΈ return
Args:
ποΈ run_query
The run_query macro provides a convenient way to run queries and fetch their results. It is a wrapper around the statement block, which is more flexible, but also more complicated to use.
ποΈ run_started_at
runstartedat outputs the timestamp that this run started, e.g. 2017-04-21 0145.678.
ποΈ schema
The schema that the model is configured to be materialized in. This is typically the same as model['schema'].
ποΈ schemas
schemas is a variable available in an on-run-end hook, representing a list of schemas that dbt built objects in on this run.
ποΈ selected_resources
The selectedresources context variable contains a list of all the nodes_
ποΈ set
set
ποΈ source
Definition
ποΈ statement blocks
statements are sql queries that hit the database and return results to your Jinja context. Hereβs an example of a statement which gets all of the states from a users .
ποΈ target
target contains information about your connection to the warehouse.
ποΈ this
this is the database representation of the current model. It is useful when:
ποΈ tojson
The tojson context method can be used to serialize a Python object primitive, eg. a dict or list to a JSON string.
ποΈ toyaml
The toyaml context method can be used to serialize a Python object primitive, eg. a dict or list to a yaml string.
ποΈ var
Variables can be passed from your dbt_project.yml file into models during compilation.
ποΈ zip
zip