File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 99license = Apache-2.0
1010license_files = LICENSE.txt, NOTICE
1111classifiers =
12- Development Status :: 5 - Production/Stable
12+ Development Status :: 4 - Beta
1313 Environment :: Console
1414 Environment :: Other Environment
1515 Intended Audience :: Developers
Original file line number Diff line number Diff line change 9898from .telemetry_oob import TelemetryService
9999from .time_util import HeartBeatTimer , get_time_millis
100100from .util_text import construct_hostname , parse_account , split_statements
101+ from .version import VERSION
101102
102103DEFAULT_CLIENT_PREFETCH_THREADS = 4
103104MAX_CLIENT_PREFETCH_THREADS = 10
@@ -350,9 +351,19 @@ def __init__(
350351 self .__set_error_attributes ()
351352 self .connect (** kwargs )
352353 self ._telemetry = TelemetryClient (self ._rest )
353-
354354 # get the imported modules from sys.modules
355355 self ._log_telemetry_imported_packages ()
356+ # in the future we won't need this if the backend supports prerelease versions
357+ self ._log_telemetry (
358+ TelemetryData .from_telemetry_data_dict (
359+ from_dict = {
360+ TelemetryField .KEY_IS_PRERELEASE .value : TelemetryData .FALSE
361+ if str (VERSION [2 ]).isdigit ()
362+ else TelemetryData .TRUE
363+ },
364+ timestamp = get_time_millis (),
365+ )
366+ )
356367
357368 def __del__ (self ) -> None : # pragma: no cover
358369 try :
Original file line number Diff line number Diff line change 88from __future__ import annotations
99
1010import platform
11+ import re
1112import sys
1213
1314from .version import VERSION
2021COMPILER = platform .python_compiler ()
2122
2223CLIENT_NAME = "PythonConnector" # don't change!
23- CLIENT_VERSION = "." .join ([str (v ) for v in VERSION [:3 ]])
24+
25+ # This is a short-term workaround for the backend to enable client side features for preview version, e.g. 3.1.0a1
26+ CLIENT_VERSION = (
27+ "." .join ([str (v ) for v in VERSION [:3 ]])
28+ if str (VERSION [2 ]).isdigit ()
29+ else f"{ str (VERSION [0 ])} .{ str (VERSION [1 ])} .{ re .split ('[ab]' , str (VERSION [2 ]))[0 ]} "
30+ )
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ class TelemetryField(Enum):
5050 KEY_SQLSTATE = "sql_state"
5151 KEY_DRIVER_TYPE = "driver_type"
5252 KEY_DRIVER_VERSION = "driver_version"
53+ KEY_IS_PRERELEASE = "is_prerelease"
5354 KEY_REASON = "reason"
5455 KEY_VALUE = "value"
5556 KEY_EXCEPTION = "exception"
You can’t perform that action at this time.
0 commit comments