Skip to content

Commit

Permalink
CT 2516 ensure that paths in Jinja context flags object are strings (#…
Browse files Browse the repository at this point in the history
…7678) (#7692)

(cherry picked from commit 0516192)

Co-authored-by: Gerda Shank <gerda@dbtlabs.com>
Co-authored-by: leahwicz <60146280+leahwicz@users.noreply.github.com>
  • Loading branch information
3 people authored May 25, 2023
1 parent a3e6a48 commit 890bc16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230522-135007.yaml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions core/dbt/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 890bc16

Please sign in to comment.