Skip to content

E2E POC for python telemetry for connect logs #581

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

Merged
merged 269 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
46af92e
[ES-402013] Close cursors before closing connection (#38)
Aug 23, 2022
a9e6828
Bump version to 2.0.5 and improve CHANGELOG (#40)
Aug 23, 2022
d244b0b
fix dco issue
moderakh Aug 25, 2022
69a40c8
fix dco issue
moderakh Aug 25, 2022
402f2ca
dco tunning
moderakh Aug 25, 2022
2b638af
dco tunning
moderakh Aug 25, 2022
7d5906b
Github workflows: run checks on pull requests from forks (#47)
Aug 26, 2022
dbe5ced
OAuth implementation (#15)
moderakh Sep 14, 2022
8e9c763
Automate deploys to Pypi (#48)
Sep 22, 2022
5cb62c4
[PECO-205] Add functional examples (#52)
Sep 30, 2022
508cf57
Bump version to 2.1.0 (#54)
Oct 1, 2022
4c34b19
[SC-110400] Enabling compression in Python SQL Connector (#49)
mohitsingla-db Oct 13, 2022
4f930d1
Add tests for parameter sanitisation / escaping (#46)
Oct 14, 2022
680809e
Bump thrift dependency to 0.16.0 (#65)
Nov 8, 2022
2b8aba6
Bump version to 2.2.0 (#66)
Nov 17, 2022
bc7c122
Support Python 3.11 (#60)
Nov 28, 2022
c137fc5
Bump version to 2.2.1 (#70)
Nov 28, 2022
3c135a4
Add none check on _oauth_persistence in DatabricksOAuthProvider (#71)
jackyhu-db Dec 29, 2022
73432dc
Support custom oauth client id and redirect port (#75)
jackyhu-db Dec 29, 2022
2f6a818
Bump version to 2.2.2 (#76)
jackyhu-db Jan 3, 2023
a41810c
Merge staging ingestion into main (#78)
Jan 10, 2023
37d5454
Bump version to 2.3.0 and update changelog (#80)
Jan 10, 2023
7e46c89
Add pkgutil-style for the package (#84)
lu-wang-dl Jan 27, 2023
cbd10f2
Add SQLAlchemy Dialect (#57)
Feb 17, 2023
10fa788
Bump to version 2.4.0(#89)
Feb 21, 2023
c1fc318
Fix syntax in examples in root readme. (#92)
shea-parkes Feb 27, 2023
ff45a2b
Less strict numpy and pyarrow dependencies (#90)
Mar 7, 2023
d04fa2d
Update example in docstring so query output is valid Spark SQL (#95)
Mar 21, 2023
bab7175
Bump version to 2.4.1 (#96)
Mar 21, 2023
dfd3322
Update CODEOWNERS (#97)
moderakh Mar 24, 2023
f9d4566
Add Andre to CODEOWNERS (#98)
yunbodeng-db Mar 29, 2023
9f9801a
Add external auth provider + example (#101)
andrefurlan-db Apr 12, 2023
0a04cb7
Retry on connection timeout (#103)
andrefurlan-db Apr 13, 2023
e1ba222
[PECO-244] Make http proxies work (#81)
Apr 14, 2023
09e3ed6
Bump to version 2.5.0 (#104)
Apr 15, 2023
2453efd
Fix changelog release date for version 2.5.0
Apr 15, 2023
dc825b7
Relax sqlalchemy requirement (#113)
Apr 28, 2023
4411ee2
Update to version 2.5.1 (#114)
Apr 28, 2023
e6c8841
Fix SQLAlchemy timestamp converter + docs (#117)
May 9, 2023
600932d
Relax pandas and alembic requirements (#119)
May 9, 2023
cf4df43
Bump to version 2.5.2 (#118)
May 9, 2023
281fed8
Use urllib3 for thrift transport + reuse http connections (#131)
Jun 7, 2023
2a9ec09
Default socket timeout to 15 min (#137)
mattdeekay Jun 7, 2023
c71b68d
Bump version to 2.6.0 (#139)
Jun 7, 2023
7855ce9
Fix: some thrift RPCs failed with BadStatusLine (#141)
Jun 8, 2023
8c93500
Bump version to 2.6.1 (#142)
Jun 8, 2023
7da5eda
[ES-706907] Retry GetOperationStatus for http errors (#145)
Jun 14, 2023
9e1eb01
Bump version to 2.6.2 (#147)
Jun 14, 2023
ae079ac
[PECO-626] Support OAuth flow for Databricks Azure (#86)
jackyhu-db Jun 20, 2023
9f8f9a3
Use a separate logger for unsafe thrift responses (#153)
Jun 23, 2023
86c9adb
Improve e2e test development ergonomics (#155)
Jun 23, 2023
a9eb4dd
Don't raise exception when closing a stale Thrift session (#159)
Jun 26, 2023
996cda4
Bump to version 2.7.0 (#161)
Jun 26, 2023
363a82b
Cloud Fetch download handler (#127)
mattdeekay Jun 27, 2023
62ba2b8
Cloud Fetch download manager (#146)
mattdeekay Jul 3, 2023
38f2ee0
Cloud fetch queue and integration (#151)
mattdeekay Jul 5, 2023
f4f0510
Cloud Fetch e2e tests (#154)
mattdeekay Jul 7, 2023
4b99316
Update changelog for cloudfetch (#172)
mattdeekay Jul 10, 2023
b826c7f
Improve sqlalchemy backward compatibility with 1.3.24 (#173)
Jul 11, 2023
5cc4a21
OAuth: don't override auth headers with contents of .netrc file (#122)
Jul 12, 2023
1e5a948
Fix proxy connection pool creation (#158)
sebbegg Jul 12, 2023
11090a9
Relax pandas dependency constraint to allow ^2.0.0 (#164)
itsdani Jul 12, 2023
6d33d80
Use hex string version of operation ID instead of bytes (#170)
Jul 12, 2023
1493347
SQLAlchemy: fix has_table so it honours schema= argument (#174)
Jul 12, 2023
7f45fef
Fix socket timeout test (#144)
mattdeekay Jul 12, 2023
20bd3b0
Disable non_native_boolean_check_constraint (#120)
bkyryliuk Jul 12, 2023
8bd6367
Remove unused import for SQLAlchemy 2 compatibility (#128)
WilliamGentry Jul 12, 2023
c3f7107
Bump version to 2.8.0 (#178)
Jul 21, 2023
133d2cc
Fix typo in python README quick start example (#186)
dbarrundia-tiger Aug 9, 2023
b69604f
Configure autospec for mocked Client objects (#188)
Aug 9, 2023
1b20055
Use urllib3 for retries (#182)
Aug 9, 2023
450c1bd
Bump version to 2.9.0 (#189)
Aug 10, 2023
b23d5bd
Explicitly add urllib3 dependency (#191)
jacobus-herman Aug 10, 2023
a3ad6c4
Bump to 2.9.1 (#195)
Aug 11, 2023
de9be67
Make backwards compatible with urllib3~=1.0 (#197)
Aug 16, 2023
c325a9c
Convenience improvements to v3 retry logic (#199)
Aug 17, 2023
21d616d
Bump version to 2.9.2 (#201)
Aug 18, 2023
b7de520
Github Actions Fix: poetry install fails for python 3.7 tests (#208)
Aug 24, 2023
57aa100
Make backwards compatible with urllib3~=1.0 [Follow up #197] (#206)
Aug 24, 2023
a765748
Bump version to 2.9.3 (#209)
Aug 24, 2023
98e002f
Add note to sqlalchemy example: IDENTITY isn't supported yet (#212)
Aug 31, 2023
9f20316
[PECO-1029] Updated thrift compiler version (#216)
nithinkdb Sep 9, 2023
19bd63a
[PECO-1055] Updated thrift defs to allow Tsparkparameters (#220)
nithinkdb Sep 11, 2023
bb33511
Update changelog to indicate that 2.9.1 and 2.9.2 have been yanked. (…
Sep 13, 2023
31e2c6d
Fix changelog typo: _enable_v3_retries (#225)
Sep 18, 2023
997c266
Introduce SQLAlchemy reusable dialog tests (#125)
unj1m Sep 20, 2023
398a08b
[PECO-1026] Add Parameterized Query support to Python (#217)
nithinkdb Sep 22, 2023
e508773
Parameterized queries: Add e2e tests for inference (#227)
Sep 25, 2023
0f3105c
[PECO-1109] Parameterized Query: add suport for inferring decimal typ…
Sep 26, 2023
8e78fb4
SQLAlchemy 2: reorganise dialect files into a single directory (#231)
Sep 26, 2023
f73d610
[PECO-1083] Updated thrift files and added check for protocol version…
nithinkdb Sep 29, 2023
be4e054
[PECO-840] Port staging ingestion behaviour to new UC Volumes (#235)
Sep 30, 2023
ab21a42
Query parameters: implement support for binding NoneType parameters (…
Sep 30, 2023
c75f6fe
SQLAlchemy 2: Bump dependency version and update e2e tests for existi…
Oct 2, 2023
45011b1
Revert "[PECO-1083] Updated thrift files and added check for protocol…
Oct 2, 2023
d4db4fa
SQLAlchemy 2: add type compilation for all CamelCase types (#238)
Oct 2, 2023
51c99cb
SQLAlchemy 2: add type compilation for uppercase types (#240)
Oct 2, 2023
f6b317b
SQLAlchemy 2: Stop skipping all type tests (#242)
Oct 10, 2023
fd11df8
[PECO-1134] v3 Retries: allow users to bound the number of redirects …
Oct 10, 2023
9608db9
Parameters: Add type inference for BIGINT and TINYINT types (#246)
Oct 11, 2023
596f971
SQLAlchemy 2: Stop skipping some non-type tests (#247)
Oct 13, 2023
f3657ee
SQLAlchemy 2: implement and refactor schema reflection methods (#249)
Oct 13, 2023
b65d72c
Add GovCloud domain into AWS domains (#252)
jackyhu-db Oct 17, 2023
4b15bde
SQLAlchemy 2: Refactor __init__.py into base.py (#250)
Oct 18, 2023
2a34ade
SQLAlchemy 2: Finish implementing all of ComponentReflectionTest (#251)
Oct 18, 2023
b8919a3
SQLAlchemy 2: Finish marking all tests in the suite (#253)
Oct 18, 2023
3a8ef6d
SQLAlchemy 2: Finish organising compliance test suite (#256)
Oct 23, 2023
d799418
SQLAlchemy 2: Fix failing mypy checks from development (#257)
Oct 23, 2023
f0dea6c
Enable cloud fetch by default (#258)
Oct 25, 2023
c505cea
[PECO-1137] Reintroduce protocol checking to Python test fw (#248)
nithinkdb Oct 25, 2023
ee23215
sqla2 clean-up: make sqlalchemy optional and don't mangle the user-ag…
Oct 28, 2023
36850e7
SQLAlchemy 2: Add support for TINYINT (#265)
Oct 31, 2023
06267ba
Add OAuth M2M example (#266)
jackyhu-db Oct 31, 2023
06bd616
Native Parameters: reintroduce INLINE approach with tests (#267)
Nov 1, 2023
378f395
Document behaviour of executemany (#213)
martinitus Nov 1, 2023
936641c
SQLAlchemy 2: Expose TIMESTAMP and TIMESTAMP_NTZ types to users (#268)
Nov 1, 2023
ac7544f
Drop Python 3.7 as a supported version (#270)
Nov 1, 2023
cb91a2a
GH Workflows: remove Python 3.7 from the matrix for _all_ workflows (…
Nov 9, 2023
c2a0cac
Add README and updated example for SQLAlchemy usage (#273)
Nov 16, 2023
00e76b4
Rewrite native parameter implementation with docs and tests (#281)
Nov 16, 2023
4c43fa0
Enable v3 retries by default (#282)
Nov 17, 2023
c1c017f
security: bump pyarrow dependency to 14.0.1 (#284)
Nov 17, 2023
6e06bd1
Bump package version to 3.0.0 (#285)
Nov 17, 2023
83e8565
Fix docstring about default parameter approach (#287)
Falydoor Nov 21, 2023
be68e2f
[PECO-1286] Add tests for complex types in query results (#293)
Nov 29, 2023
56779de
sqlalchemy: fix deprecation warning for dbapi classmethod (#294)
Nov 29, 2023
e8a274b
[PECO-1297] sqlalchemy: fix: can't read columns for tables containing…
Nov 30, 2023
a7a7cce
Prepared 3.0.1 release (#297)
Dec 1, 2023
9d12913
Make contents of `__init__.py` equal across projects (#304)
pietern Dec 26, 2023
211b986
Fix URI construction in ThriftBackend (#303)
NodeJSmith Jan 23, 2024
f1213ff
[sqlalchemy] Add table and column comment support (#329)
Jan 25, 2024
55b48aa
Pin pandas and urllib3 versions to fix runtime issues in dbt-databric…
benc-db Jan 25, 2024
b1eea30
SQLAlchemy: TINYINT types didn't reflect properly (#315)
TimTheinAtTabs Jan 25, 2024
577d1e9
[PECO-1435] Restore `tests.py` to the test suite (#331)
Jan 26, 2024
26b81c1
Bump to version 3.0.2 (#335)
Jan 26, 2024
a697b2a
Update some outdated OAuth comments (#339)
jackyhu-db Jan 30, 2024
01a8473
Redact the URL query parameters from the urllib3.connectionpool logs …
mkazia-db Feb 2, 2024
76c16fc
Bump to version 3.0.3 (#344)
jackyhu-db Feb 2, 2024
a7d0f6e
[PECO-1411] Support Databricks OAuth on GCP (#338)
jackyhu-db Feb 5, 2024
4cc8225
[PECO-1414] Support Databricks native OAuth in Azure (#351)
jackyhu-db Feb 13, 2024
82d1e39
Prep for Test Automation (#352)
benc-db Feb 14, 2024
a4a7ff8
Update code owners (#345)
yunbodeng-db Feb 14, 2024
23e56a9
Reverting retry behavior on 429s/503s to how it worked in 2.9.3 (#349)
benc-db Feb 15, 2024
ae14739
Bump to version 3.1.0 (#358)
jackyhu-db Feb 16, 2024
d040f32
[PECO-1440] Expose current query id on cursor object (#364)
kravets-levko Mar 4, 2024
74a7c48
Add a default for retry after (#371)
benc-db Mar 14, 2024
1dbf808
Fix boolean literals (#357)
aholyoke Mar 14, 2024
aad4439
Don't retry network requests that fail with code 403 (#373)
Mar 15, 2024
0971a3f
Bump to 3.1.1 (#374)
benc-db Mar 19, 2024
0a0404d
Fix cookie setting (#379)
benc-db Mar 27, 2024
a208f55
Fixing a couple type problems: how I would address most of #381 (#382)
wyattscarpenter Apr 2, 2024
6e877bf
fix the return types of the classes' __enter__ functions (#384)
wyattscarpenter Apr 2, 2024
eca1485
Add Kravets Levko to codeowners (#386)
kravets-levko Apr 15, 2024
a9590b8
Prepare for 3.1.2 (#387)
benc-db Apr 18, 2024
4a82f2e
Update the proxy authentication (#354)
amir-haroun May 23, 2024
34b0d2a
Fix failing tests (#392)
kravets-levko May 28, 2024
d40eda5
Relax `pyarrow` pin (#389)
dhirschfeld May 29, 2024
72cbc75
Fix log error in oauth.py (#269)
susodapop May 29, 2024
50c6891
Enable `delta.feature.allowColumnDefaults` for all tables (#343)
dhirschfeld May 30, 2024
e530c53
Fix SQLAlchemy tests (#393)
kravets-levko May 30, 2024
c7cbd50
Add more debug logging for CloudFetch (#395)
kravets-levko Jun 6, 2024
8e74098
Update Thrift package (#397)
m1n0 Jun 12, 2024
1a863d9
Prepare release 3.2.0 (#396)
kravets-levko Jun 13, 2024
91481cc
move py.typed to correct places (#403)
wyattscarpenter Jul 2, 2024
9d72daf
Upgrade mypy (#406)
wyattscarpenter Jul 3, 2024
46a8989
Do not retry failing requests with status code 401 (#408)
Hodnebo Jul 3, 2024
9822ba3
[PECO-1715] Remove username/password (BasicAuth) auth option (#409)
jackyhu-db Jul 4, 2024
f8d2630
[PECO-1751] Refactor CloudFetch downloader: handle files sequentially…
kravets-levko Jul 11, 2024
bb84016
Fix CloudFetch retry policy to be compatible with all `urllib3` versi…
kravets-levko Jul 11, 2024
3a7d7a4
Disable SSL verification for CloudFetch links (#414)
kravets-levko Jul 16, 2024
7e5155a
Prepare relese 3.3.0 (#415)
kravets-levko Jul 17, 2024
6c39c30
Fix pandas 2.2.2 support (#416)
kfollesdal Jul 26, 2024
24eca04
[PECO-1801] Make OAuth as the default authenticator if no authenticat…
jackyhu-db Aug 1, 2024
1a598cd
[PECO-1857] Use SSL options with HTTPS connection pool (#425)
kravets-levko Aug 22, 2024
906bae8
Prepare release v3.4.0 (#430)
kravets-levko Aug 27, 2024
354a7c4
[PECO-1926] Create a non pyarrow flow to handle small results for the…
jprakash-db Oct 3, 2024
72a77be
[PECO-1961] On non-retryable error, ensure PySQL includes useful info…
shivam2680 Oct 3, 2024
a8323c5
Reformatted all the files using black (#448)
jprakash-db Oct 3, 2024
46f7e06
Prepare release v3.5.0 (#457)
jackyhu-db Oct 18, 2024
b424e2e
[PECO-2051] Add custom auth headers into cloud fetch request (#460)
jackyhu-db Oct 25, 2024
67cb66a
Prepare release 3.6.0 (#461)
jackyhu-db Oct 25, 2024
b81a10e
[ PECO - 1768 ] PySQL: adjust HTTP retry logic to align with Go and N…
jprakash-db Nov 20, 2024
ff7c284
[ PECO-2065 ] Create the async execution flow for the PySQL Connector…
jprakash-db Nov 26, 2024
0f1c7b8
Fix for check_types github action failing (#472)
jprakash-db Nov 26, 2024
e9a82ea
Remove upper caps on dependencies (#452)
arredond Dec 5, 2024
ca410cc
Updated the doc to specify native parameters in PUT operation is not …
jprakash-db Dec 6, 2024
78ad2e0
Incorrect rows in inline fetch result (#479)
jprakash-db Dec 22, 2024
17b56a3
Bumped up to version 3.7.0 (#482)
jprakash-db Dec 23, 2024
99782c3
PySQL Connector split into connector and sqlalchemy (#444)
jprakash-db Dec 27, 2024
1fd7bd9
Removed CI CD for python3.8 (#490)
jprakash-db Jan 17, 2025
fe8a609
Added CI CD upto python 3.12 (#491)
jprakash-db Jan 18, 2025
1b925cc
Merging changes from v3.7.1 release (#488)
jprakash-db Jan 18, 2025
9f8b89d
Bumped up to version 4.0.0 (#493)
jprakash-db Jan 22, 2025
420878d
Updated action's version (#455)
newwingbird Feb 27, 2025
4d84361
Support Python 3.13 and update deps (#510)
dhirschfeld Feb 27, 2025
cda81bb
Improve debugging + fix PR review template (#514)
samikshya-db Mar 2, 2025
59ee2ac
Forward porting all changes into 4.x.x. uptil v3.7.3 (#529)
jprakash-db Mar 7, 2025
3c9576f
Updated the CODEOWNERS (#531)
jprakash-db Mar 7, 2025
a947750
Add version check for urllib3 in backoff calculation (#526)
shivam2680 Mar 11, 2025
1031637
[ES-1372353] make user_agent_header part of public API (#530)
shivam2680 Mar 12, 2025
a6fbb83
Updates runner used to run DCO check to use databricks-protected-runn…
madhav-db Mar 12, 2025
5bf56aa
Support multiple timestamp formats in non arrow flow (#533)
jprakash-db Mar 18, 2025
c0d687c
prepare release for v4.0.1 (#534)
shivam2680 Mar 19, 2025
9718ae6
Relaxed bound for python-dateutil (#538)
jprakash-db Apr 1, 2025
8959bba
Bumped up the version for 4.0.2 (#539)
jprakash-db Apr 1, 2025
5326cb7
Added example for async execute query (#537)
jprakash-db Apr 1, 2025
4f195f8
Added urllib3 version check (#547)
jprakash-db Apr 21, 2025
b9b9498
Bump version to 4.0.3 (#549)
jprakash-db Apr 22, 2025
c43d480
Cleanup fields as they might be deprecated/removed/change in the futu…
vikrantpuppala May 9, 2025
9b0638e
Refactor decimal conversion in PyArrow tables to use direct casting (…
jayantsing-db May 12, 2025
3cd70e2
[PECOBLR-361] convert column table to arrow if arrow present (#551)
shivam2680 May 16, 2025
cc09200
Update CODEOWNERS (#562)
jprakash-db May 21, 2025
6354c97
Enhance Cursor close handling and context manager exception managemen…
madhav-db May 21, 2025
d527a9d
PECOBLR-86 improve logging on python driver (#556)
saishreeeee May 22, 2025
b5d8c2b
Update github actions run conditions (#569)
jprakash-db May 26, 2025
0dc49ff
New Complex type test table + Github Action changes (#575)
jprakash-db May 28, 2025
24c48f1
Added classes required for telemetry (#572)
saishreeeee May 30, 2025
7d3ee9d
telemetry client and logs
saishreeeee Jun 3, 2025
8c1dbeb
fixed error args
saishreeeee Jun 3, 2025
01f19e1
fixed type of client_app_name
saishreeeee Jun 3, 2025
18e4cd0
formatting
saishreeeee Jun 3, 2025
71a4232
TelemetryManager
saishreeeee Jun 3, 2025
3232079
fixed statement_id in latency_logger
saishreeeee Jun 3, 2025
ba19a90
updated latency_logger
saishreeeee Jun 3, 2025
3b246e4
only added initial telemetry logs
saishreeeee Jun 3, 2025
d02c57a
removed error logs logic
saishreeeee Jun 3, 2025
1e6246f
removed user logging for telemetry errors
saishreeeee Jun 3, 2025
9887f9d
removed no-op telemetry client
saishreeeee Jun 3, 2025
1ceb658
changed order of args in telemetry client
saishreeeee Jun 3, 2025
d8674e4
shifted thread pool executor to telemetry manager
saishreeeee Jun 4, 2025
3c76876
formatting
saishreeeee Jun 4, 2025
73953a1
Revert "shifted thread pool executor to telemetry manager"
saishreeeee Jun 4, 2025
8ec7db1
telemetry client changes
saishreeeee Jun 4, 2025
d1fcad4
Merge remote-tracking branch 'origin/telemetry' into PECOBLR-457
saishreeeee Jun 4, 2025
1256bb6
fixed spelling error
saishreeeee Jun 4, 2025
1c1c1be
restructured telemetry client
saishreeeee Jun 5, 2025
44fade7
unit test for telemetry client
saishreeeee Jun 5, 2025
8a871e3
modified get_telemetry_client and some comments
saishreeeee Jun 6, 2025
fa6274e
changed driver system config
saishreeeee Jun 6, 2025
5f8dff5
added log statements
saishreeeee Jun 6, 2025
906c187
changed TelemetryClientFactory to a static class and made changes in …
saishreeeee Jun 6, 2025
f6bd9ad
added lock in TelemetryClientFactory and specified dict type in _client
saishreeeee Jun 6, 2025
c47bc73
changed type of attribute _executor in TelemetryClientFactory
saishreeeee Jun 6, 2025
4a2386b
removed discovery_url
saishreeeee Jun 8, 2025
e4c05d1
removed unused params from driver connection params, initialize_telem…
saishreeeee Jun 9, 2025
bf92c6c
renamed other as client_cert in auth_mech
saishreeeee Jun 9, 2025
e218ef9
lazy logging, renamed private variables, defined telemetry endpoints …
saishreeeee Jun 9, 2025
9615519
changed unittest to pytest
saishreeeee Jun 9, 2025
c084846
shifted EnumEncoder to telemetry/utils.py
saishreeeee Jun 9, 2025
7394295
changed type of _clients in TelemetryClientFactory
saishreeeee Jun 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/databricks/sql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
TSparkParameter,
TOperationState,
)
from databricks.sql.telemetry.telemetry_client import (
TelemetryClientFactory,
TelemetryHelper,
)
from databricks.sql.telemetry.models.enums import DatabricksClientType
from databricks.sql.telemetry.models.event import (
DriverConnectionParameters,
HostDetails,
)


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -294,6 +303,31 @@ def read(self) -> Optional[OAuthToken]:
kwargs.get("use_inline_params", False)
)

TelemetryClientFactory.initialize_telemetry_client(
telemetry_enabled=self.telemetry_enabled,
connection_uuid=self.get_session_id_hex(),
auth_provider=auth_provider,
host_url=self.host,
)

self._telemetry_client = TelemetryClientFactory.get_telemetry_client(
connection_uuid=self.get_session_id_hex()
)

driver_connection_params = DriverConnectionParameters(
http_path=http_path,
mode=DatabricksClientType.THRIFT,
host_info=HostDetails(host_url=server_hostname, port=self.port),
auth_mech=TelemetryHelper.get_auth_mechanism(auth_provider),
auth_flow=TelemetryHelper.get_auth_flow(auth_provider),
socket_timeout=kwargs.get("_socket_timeout", None),
)

self._telemetry_client.export_initial_telemetry_log(
driver_connection_params=driver_connection_params,
user_agent=useragent_header,
)

def _set_use_inline_params_with_warning(self, value: Union[bool, str]):
"""Valid values are True, False, and "silent"

Expand Down Expand Up @@ -430,6 +464,8 @@ def _close(self, close_cursors=True) -> None:

self.open = False

self._telemetry_client.close()

def commit(self):
"""No-op because Databricks does not support transactions"""
pass
Expand Down
9 changes: 4 additions & 5 deletions src/databricks/sql/telemetry/models/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

class AuthFlow(Enum):
TOKEN_PASSTHROUGH = "token_passthrough"
CLIENT_CREDENTIALS = "client_credentials"
BROWSER_BASED_AUTHENTICATION = "browser_based_authentication"
AZURE_MANAGED_IDENTITIES = "azure_managed_identities"


class AuthMech(Enum):
OTHER = "other"
PAT = "pat"
OAUTH = "oauth"
CLIENT_CERT = "CLIENT_CERT" # ssl certificate authentication
PAT = "PAT" # Personal Access Token authentication
DATABRICKS_OAUTH = "DATABRICKS_OAUTH" # Databricks-managed OAuth flow
EXTERNAL_AUTH = "EXTERNAL_AUTH" # External identity provider (AWS, Azure, etc.)


class DatabricksClientType(Enum):
Expand Down
31 changes: 12 additions & 19 deletions src/databricks/sql/telemetry/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ExecutionResultFormat,
)
from typing import Optional
from databricks.sql.telemetry.utils import EnumEncoder


@dataclass
Expand Down Expand Up @@ -40,26 +41,18 @@ class DriverConnectionParameters:
host_info (HostDetails): Details about the host connection
auth_mech (AuthMech): The authentication mechanism used
auth_flow (AuthFlow): The authentication flow type
auth_scope (str): The scope of authentication
discovery_url (str): URL for service discovery
allowed_volume_ingestion_paths (str): JSON string of allowed paths for volume operations
azure_tenant_id (str): Azure tenant ID for Azure authentication
socket_timeout (int): Connection timeout in milliseconds
"""

http_path: str
mode: DatabricksClientType
host_info: HostDetails
auth_mech: AuthMech
auth_flow: AuthFlow
auth_scope: str
discovery_url: str
allowed_volume_ingestion_paths: str
azure_tenant_id: str
socket_timeout: int
auth_mech: Optional[AuthMech] = None
auth_flow: Optional[AuthFlow] = None
socket_timeout: Optional[int] = None

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand Down Expand Up @@ -89,13 +82,13 @@ class DriverSystemConfiguration:
runtime_name: str
runtime_version: str
runtime_vendor: str
client_app_name: str
locale_name: str
driver_name: str
char_set_encoding: str
client_app_name: Optional[str] = None
locale_name: Optional[str] = None

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -113,7 +106,7 @@ class DriverVolumeOperation:
volume_path: str

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -131,7 +124,7 @@ class DriverErrorInfo:
stack_trace: str

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -153,7 +146,7 @@ class SqlExecutionEvent:
retry_count: int

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand Down Expand Up @@ -186,4 +179,4 @@ class TelemetryEvent:
operation_latency_ms: Optional[int] = None

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)
9 changes: 5 additions & 4 deletions src/databricks/sql/telemetry/models/frontend_logs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
from dataclasses import dataclass, asdict
from databricks.sql.telemetry.models.event import TelemetryEvent
from databricks.sql.telemetry.utils import EnumEncoder
from typing import Optional


Expand All @@ -19,7 +20,7 @@ class TelemetryClientContext:
user_agent: str

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -35,7 +36,7 @@ class FrontendLogContext:
client_context: TelemetryClientContext

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -51,7 +52,7 @@ class FrontendLogEntry:
sql_driver_log: TelemetryEvent

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)


@dataclass
Expand All @@ -74,4 +75,4 @@ class TelemetryFrontendLog:
workspace_id: Optional[int] = None

def to_json(self):
return json.dumps(asdict(self))
return json.dumps(asdict(self), cls=EnumEncoder)
Loading
Loading