From 1447ce4564c955c8cd4791e4adada1e937f42554 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Wed, 24 May 2023 08:24:36 -0400 Subject: [PATCH] CT 2516 ensure that paths in Jinja context flags object are strings (#7678) (cherry picked from commit 0516192d6915a376edeb9d524ccb6989499d65a6) --- .changes/unreleased/Fixes-20230522-135007.yaml | 6 ++++++ core/dbt/flags.py | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 .changes/unreleased/Fixes-20230522-135007.yaml diff --git a/.changes/unreleased/Fixes-20230522-135007.yaml b/.changes/unreleased/Fixes-20230522-135007.yaml new file mode 100644 index 00000000000..bef33d2fa30 --- /dev/null +++ b/.changes/unreleased/Fixes-20230522-135007.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Stringify flag paths for Jinja context +time: 2023-05-22T13:50:07.897354-04:00 +custom: + Author: gshank + Issue: "7495" diff --git a/core/dbt/flags.py b/core/dbt/flags.py index a87c9e8d37e..37462659c97 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -3,6 +3,7 @@ from argparse import Namespace from multiprocessing import get_context from typing import Optional +from pathlib import Path # for setting up logger for legacy logger @@ -95,6 +96,8 @@ def get_flag_dict(): def get_flag_obj(): new_flags = Namespace() for key, val in get_flag_dict().items(): + if isinstance(val, Path): + val = str(val) setattr(new_flags, key.upper(), val) # The following 3 are CLI arguments only so they're not full-fledged flags, # but we put in flags for users.