Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add query recording options #135

Merged
merged 8 commits into from
May 29, 2024
Merged

add query recording options #135

merged 8 commits into from
May 29, 2024

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented May 17, 2024

resolves #140 / MNTL-268

Description

Add option to record by record type.

Checklist

@cla-bot cla-bot bot added the cla:yes label May 17, 2024
Copy link

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 64.78%. Comparing base (a28ff8a) to head (eb0c3ff).

Files Patch % Lines
dbt_common/record.py 75.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
- Coverage   64.81%   64.78%   -0.03%     
==========================================
  Files          50       50              
  Lines        3106     3115       +9     
==========================================
+ Hits         2013     2018       +5     
- Misses       1093     1097       +4     
Flag Coverage Δ
unit 64.78% <75.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emmyoop emmyoop force-pushed the er/MNTL-268-dynamic-recording branch from 7382ad0 to 8a1b6a4 Compare May 23, 2024 16:21
dbt_common/record.py Outdated Show resolved Hide resolved
dbt_common/record.py Show resolved Hide resolved
@emmyoop emmyoop requested a review from peterallenwebb May 28, 2024 18:54
@emmyoop emmyoop marked this pull request as ready for review May 28, 2024 18:54
@emmyoop emmyoop requested a review from a team as a code owner May 28, 2024 18:54
@@ -147,17 +152,46 @@ def print_diffs(self) -> None:


def get_record_mode_from_env() -> Optional[RecorderMode]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for the current PR but a general observation, I think we are basically implementing something similar to pydantic settings functionalities here. We should consider consolidating all env readings(other than the ones that are also flags in click commands) to use it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbt-labs/dbt-core#10100 addresses this. Going to leave this as is for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

@@ -76,6 +136,10 @@ def test_func(a: int, b: str, c: Optional[str] = None) -> str:

finally:
if prev is None:
os.environ.pop("DBT_RECORD", None)
os.environ.pop("DBT_RECORDER_MODE", None)
Copy link
Contributor

@ChenyuLInx ChenyuLInx May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

track previous and removing it might be easier to read if we write a fixture with yield in the middle?

@pytest.fixture
def setup():
	prev = os.environ.get("DBT_RECORDER_MODE", None)
   	yield
	os.environ["DBT_RECORDER_MODE"] = prev

Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not resolve #140 right? It just add the option part?

@emmyoop
Copy link
Member Author

emmyoop commented May 29, 2024

@ChenyuLInx the scope of #140 changed while working on this ticket. I've updated it to reflect that we're just going to filter by record type. So this will close #140.

@emmyoop emmyoop requested a review from ChenyuLInx May 29, 2024 14:51
@emmyoop emmyoop added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit 315aeae May 29, 2024
20 of 57 checks passed
@emmyoop emmyoop deleted the er/MNTL-268-dynamic-recording branch May 29, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dynamic recording
4 participants