Skip to content

Commit cff40d8

Browse files
authored
Merge branch 'master' into LAB-118
2 parents ba05a63 + 101a488 commit cff40d8

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

data_diff/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def _get_log_handlers(is_dbt: Optional[bool] = False) -> Dict[str, logging.Handl
4848
rich_handler.setLevel(logging.WARN)
4949
handlers["rich_handler"] = rich_handler
5050

51-
# only use log_status_handler in a terminal
52-
if rich_handler.console.is_terminal and is_dbt:
51+
# only use log_status_handler in an interactive terminal session
52+
if rich_handler.console.is_interactive and is_dbt:
5353
log_status_handler = LogStatusHandler()
5454
log_status_handler.setFormatter(logging.Formatter(log_format_status, datefmt=date_format))
5555
log_status_handler.setLevel(logging.DEBUG)

data_diff/dbt.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .format import jsonify, jsonify_error
2424
from .tracking import (
2525
bool_ask_for_email,
26+
bool_notify_about_extension,
2627
create_email_signup_event_json,
2728
set_entrypoint_name,
2829
set_dbt_user_id,
@@ -48,6 +49,7 @@
4849

4950
logger = getLogger(__name__)
5051
CLOUD_DOC_URL = "https://docs.datafold.com/development_testing/cloud"
52+
EXTENSION_INSTALL_URL = "https://get.datafold.com/datafold-vs-code-install"
5153

5254

5355
class TDiffVars(pydantic.BaseModel):
@@ -155,6 +157,8 @@ def dbt_diff(
155157
for thread in diff_threads:
156158
thread.join()
157159

160+
_extension_notification()
161+
158162

159163
def _get_diff_vars(
160164
dbt_parser: "DbtParser",
@@ -517,3 +521,10 @@ def _email_signup() -> None:
517521
if email:
518522
event_json = create_email_signup_event_json(email)
519523
run_as_daemon(send_event_json, event_json)
524+
525+
526+
def _extension_notification() -> None:
527+
if bool_notify_about_extension():
528+
rich.print(
529+
f"\n\nHaving a good time diffing? :heart_eyes-emoji:\nMake sure to check out the free [bold]Datafold VS Code extension[/bold] for more a more seamless diff experience:\n{EXTENSION_INSTALL_URL}"
530+
)

data_diff/tracking.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ def bool_ask_for_email() -> bool:
6363
return False
6464

6565

66+
def bool_notify_about_extension() -> bool:
67+
profile = _load_profile()
68+
console = get_console()
69+
if "notified_about_extension" not in profile and console.is_interactive:
70+
profile["notified_about_extension"] = ""
71+
with open(DEFAULT_PROFILE, "w") as conf:
72+
toml.dump(profile, conf)
73+
return True
74+
return False
75+
76+
6677
g_tracking_enabled = True
6778
g_anonymous_id = None
6879

0 commit comments

Comments
 (0)