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 100100from .telemetry_oob import TelemetryService
101101from .time_util import HeartBeatTimer , get_time_millis
102102from .util_text import construct_hostname , parse_account , split_statements
103+ from .version import VERSION
103104
104105DEFAULT_CLIENT_PREFETCH_THREADS = 4
105106MAX_CLIENT_PREFETCH_THREADS = 10
@@ -371,9 +372,19 @@ def __init__(
371372 self .__set_error_attributes ()
372373 self .connect (** kwargs )
373374 self ._telemetry = TelemetryClient (self ._rest )
374-
375375 # get the imported modules from sys.modules
376376 self ._log_telemetry_imported_packages ()
377+ # in the future we won't need this if the backend supports prerelease versions
378+ self ._log_telemetry (
379+ TelemetryData .from_telemetry_data_dict (
380+ from_dict = {
381+ TelemetryField .KEY_IS_PRERELEASE .value : TelemetryData .FALSE
382+ if str (VERSION [2 ]).isdigit ()
383+ else TelemetryData .TRUE
384+ },
385+ timestamp = get_time_millis (),
386+ )
387+ )
377388
378389 def __del__ (self ) -> None : # pragma: no cover
379390 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