__file__ and Path

{{ __file__ }} allows you to access the the path to the YML file.

{{ Path(...) }} allows you convert any string to a pathlib Path object. When using this Jinja function, users also get access to Path's methods and operators.

{{ __file__ }} and {{ Path(...) }} can be used together to define relative paths.

# profile.yml

default_profile:
  adapters:
    dbt_example:
      type: dbt
      project_dir: "{{ Path(__file__).parent / 'dbt' }}"