Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit b6b4618

Browse files
authored
Merge pull request #327 from datafold/version-tracking
Add version module and add version to tracking
2 parents a0a9238 + 7444053 commit b6b4618

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

data_diff/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
from .table_segment import TableSegment
1010
from .utils import eval_name_template
1111

12-
__version__ = "0.3.0rc4"
13-
14-
1512
def connect_to_table(
1613
db_info: Union[str, dict],
1714
table_name: Union[DbPath, str],

data_diff/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from .parse_time import parse_time_before, UNITS_STR, ParseError
2222
from .config import apply_config_from_file
2323
from .tracking import disable_tracking
24-
from . import __version__
24+
from .version import __version__
2525

2626

2727
LOG_FORMAT = "[%(asctime)s] %(levelname)s - %(message)s"

data_diff/tracking.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
from typing import Any, Dict, Optional
1111
import urllib.request
1212
from uuid import uuid4
13-
1413
import toml
1514

15+
from .version import __version__
16+
1617
TRACK_URL = "https://hosted.rudderlabs.com/v1/track"
1718
START_EVENT = "os_diff_run_start"
1819
END_EVENT = "os_diff_run_end"
@@ -68,6 +69,7 @@ def create_start_event_json(diff_options: Dict[str, Any]):
6869
"os_version": platform.platform(),
6970
"python_version": f"{platform.python_version()}/{platform.python_implementation()}",
7071
"diff_options": diff_options,
72+
"data_diff_version:": __version__,
7173
},
7274
}
7375

@@ -96,6 +98,7 @@ def create_end_event_json(
9698
"table_2_rows_cnt": table2_count,
9799
"diff_rows_cnt": diff_count,
98100
"error_message": error,
101+
"data_diff_version:": __version__,
99102
},
100103
}
101104

@@ -104,7 +107,10 @@ def send_event_json(event_json):
104107
if not g_tracking_enabled:
105108
raise RuntimeError("Won't send; tracking is disabled!")
106109

107-
headers = {"Content-Type": "application/json", "Authorization": "Basic MkhndE00SGNxOUJtZWlDcU5ZaHo3Tzl0a2pNOg=="}
110+
headers = {
111+
"Content-Type": "application/json",
112+
"Authorization": "Basic MkhndE00SGNxOUJtZWlDcU5ZaHo3Tzl0a2pNOg==",
113+
}
108114
data = json.dumps(event_json).encode()
109115
try:
110116
req = urllib.request.Request(TRACK_URL, data=data, headers=headers)

data_diff/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.3.0rc4"

0 commit comments

Comments
 (0)