Skip to content

Commit

Permalink
reflect dbt-common changes
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed May 28, 2024
1 parent 36d4f99 commit 26a8b1f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions core/dbt/cli/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@
from dbt_common.events.helpers import get_json_string_utcnow
from dbt_common.exceptions import DbtBaseException as DbtException
from dbt_common.invocation import reset_invocation_id
from dbt_common.record import Recorder, RecorderMode, get_record_mode_from_env
from dbt_common.record import (
Recorder,
RecorderMode,
get_record_mode_from_env,
get_record_types_from_env,
)
from dbt_common.utils import cast_dict_to_dict_of_strings


Expand Down Expand Up @@ -100,23 +105,22 @@ def wrapper(*args, **kwargs):

def setup_record_replay():
rec_mode = get_record_mode_from_env()
rec_types = get_record_types_from_env()

recorder: Optional[Recorder] = None
if rec_mode == RecorderMode.REPLAY:
recording_path = os.environ["DBT_REPLAY"]
recorder = Recorder(RecorderMode.REPLAY, recording_path)
recording_path = os.environ.get("DBT_RECORDER_REPLAY_PATH")
recorder = Recorder(RecorderMode.REPLAY, types=rec_types, recording_path=recording_path)
elif rec_mode == RecorderMode.RECORD:
recorder = Recorder(RecorderMode.RECORD)
elif rec_mode == RecorderMode.RECORD_QUERIES:
recorder = Recorder(RecorderMode.RECORD_QUERIES)
recorder = Recorder(RecorderMode.RECORD, types=rec_types)

get_invocation_context().recorder = recorder


def tear_down_record_replay():
recorder = get_invocation_context().recorder
if recorder is not None:
if recorder.mode == RecorderMode.RECORD or recorder.mode == RecorderMode.RECORD_QUERIES:
if recorder.mode == RecorderMode.RECORD:
recorder.write("recording.json")
elif recorder.mode == RecorderMode.REPLAY:
recorder.write_diffs("replay_diffs.json")
Expand Down

0 comments on commit 26a8b1f

Please sign in to comment.