Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3e3d732
added telemetry emission for AWS Lambda, AWS EC2, Azure VM, GCE VM, a…
sfc-gh-sshetkar Jun 23, 2025
0d6683b
added github action platform check
sfc-gh-sshetkar Jun 24, 2025
f7879bd
linter fixes
sfc-gh-sshetkar Jun 24, 2025
2e5168f
added checks for managed identity
sfc-gh-sshetkar Jun 25, 2025
a8ad08d
put telemetry on a separate thread since it makes some network calls …
sfc-gh-sshetkar Jun 26, 2025
ce185da
added check for aws identity and refactored ec2 check to use AWS library
sfc-gh-sshetkar Jun 26, 2025
b1734ec
updated name for aws arn identity check function
sfc-gh-sshetkar Jun 30, 2025
99f4bf8
added gcp identity checks and updated AWS checks to do generic except…
sfc-gh-sshetkar Jun 30, 2025
c66c054
updated azure managed identity check to go against the default snowfl…
sfc-gh-sshetkar Jul 2, 2025
d62e955
switched to 0.5 second timeout because eventually it won't be run on …
sfc-gh-sshetkar Jul 3, 2025
44ac14c
changed to return list of signals instead of dictionary of true and f…
sfc-gh-sshetkar Jul 3, 2025
d163d32
switched to detect platforms by adding it to the base_auth data which…
sfc-gh-sshetkar Jul 3, 2025
69c637e
changed gcp identity check to be 0.5 seconds for timeout
sfc-gh-sshetkar Jul 4, 2025
87668c6
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Jul 4, 2025
fb4ccf7
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Jul 7, 2025
7a527ab
added unit tests for detecting platforms
sfc-gh-sshetkar Jul 7, 2025
fc611be
refactored platform detection to it's own file and updates unit tests
sfc-gh-sshetkar Jul 7, 2025
48e0541
updated unit tests
sfc-gh-sshetkar Jul 7, 2025
2394414
mocked detect_platform in connection tests to not affect the tests in…
sfc-gh-sshetkar Jul 8, 2025
0963b72
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Jul 9, 2025
4467c00
changed to 200 millisecond timeout
sfc-gh-sshetkar Jul 17, 2025
bfb4b67
skip test_auth_mfa on windows since it runs inconsistently on that OS
sfc-gh-sshetkar Jul 17, 2025
f0dd5c7
added parameter for timeout that user can configure
sfc-gh-sshetkar Jul 18, 2025
0d347d4
added None type to detect_platforms so it gives correct type hinting
sfc-gh-sshetkar Jul 18, 2025
bd7082a
added timeout signals, added parameter for user to be able control ti…
sfc-gh-sshetkar Jul 21, 2025
bff44f1
added getter and setter for new platform detection timeout field
sfc-gh-sshetkar Jul 21, 2025
ec63ad0
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Jul 21, 2025
76fa99c
make sure platform timeout detection is mocked
sfc-gh-sshetkar Jul 21, 2025
c9577da
put the skip old driver on my test instead of the other test_bad_db test
sfc-gh-sshetkar Jul 22, 2025
e5590a7
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-mmishchenko Jul 24, 2025
bee50ef
added doc comments for every function in the detect platform module
sfc-gh-sshetkar Jul 28, 2025
30b037c
updated client side parameter to include units. changed to only use f…
sfc-gh-sshetkar Jul 28, 2025
2b74108
added functools.cache on platform detection since results are not sup…
sfc-gh-sshetkar Jul 28, 2025
520fa2e
changed resource for azure vm so that it could work in all scenarios …
sfc-gh-sshetkar Jul 28, 2025
2d42ed4
changed to compare against status code for gcp identity instead of te…
sfc-gh-sshetkar Jul 28, 2025
e2b6a32
removed the extraneous else if statement for NOT_DETECT since we don'…
sfc-gh-sshetkar Jul 28, 2025
06f94cb
chanaged azure managed identity check to not depend on previous check…
sfc-gh-sshetkar Jul 28, 2025
9710ce2
add try except clause on the detect_platform so that no exceptions le…
sfc-gh-sshetkar Jul 28, 2025
7917c0d
clear cache after every test run. used actual response class to avoid…
sfc-gh-sshetkar Jul 28, 2025
971a0bd
updated tests and csphelpers to use consistent mock enviornments with…
sfc-gh-sshetkar Jul 29, 2025
8e79c1d
added parameterized test for testing valid aws arn identities
sfc-gh-sshetkar Jul 29, 2025
527efd9
added negative tests
sfc-gh-sshetkar Jul 29, 2025
6b7a1a2
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Jul 29, 2025
a2c4049
added yield so cache clearing happens after every test
sfc-gh-sshetkar Jul 29, 2025
c27b8ec
updated os dictionary patching so it shouldn't use the actual OS envi…
sfc-gh-sshetkar Jul 30, 2025
787ffe7
updated parameter name injected in connection integration test
sfc-gh-sshetkar Jul 30, 2025
c082f40
removed caching off the function to test if that is what is causing f…
sfc-gh-sshetkar Jul 30, 2025
fe14cd8
patched os dictionary so that is clears it before every test and then…
sfc-gh-sshetkar Jul 30, 2025
3e16e1c
added caching back in to see if it runs on github actions tests
sfc-gh-sshetkar Jul 30, 2025
e7995a6
make test run serially to avoid caching issue and clear cache before …
sfc-gh-sshetkar Jul 31, 2025
a8085f7
addressed comments related to fixed comments, optimizing platform det…
sfc-gh-sshetkar Aug 1, 2025
f4dcfe6
updated name for has_azure_managed_identity in the signal response
sfc-gh-sshetkar Aug 1, 2025
62c2fad
got rid of BrokenMetadataService and changed to have the base class s…
sfc-gh-sshetkar Aug 1, 2025
5918f5b
updated github to not use fakemetadataservice since it doesn't implem…
sfc-gh-sshetkar Aug 1, 2025
c7a238c
updated to separate out AWS lambda as another fake class and used tha…
sfc-gh-sshetkar Aug 1, 2025
2134261
updated fake azure vm with no metadata endpoint to not use weird way …
sfc-gh-sshetkar Aug 1, 2025
f3319c5
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
sfc-gh-sshetkar Aug 1, 2025
bdacd5c
added check in gce vm check to not throw an exception if headers don'…
sfc-gh-sshetkar Aug 1, 2025
6e3a969
mocked the timeout parallel test properly to match what values of the…
sfc-gh-sshetkar Aug 1, 2025
440dc28
forgot to unpack args parameter on __exit__ for FakeAwsLambdaEnvironment
sfc-gh-sshetkar Aug 1, 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
6 changes: 6 additions & 0 deletions src/snowflake/connector/auth/_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
PYTHON_CONNECTOR_USER_AGENT,
ReauthenticationRequest,
)
from ..platform_detection import detect_platforms
from ..sqlstate import SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED
from ..token_cache import TokenCache, TokenKey, TokenType
from ..version import VERSION
Expand Down Expand Up @@ -101,6 +102,7 @@ def base_auth_data(
login_timeout: int | None = None,
network_timeout: int | None = None,
socket_timeout: int | None = None,
platform_detection_timeout_seconds: float | None = None,
):
return {
"data": {
Expand All @@ -122,6 +124,9 @@ def base_auth_data(
"LOGIN_TIMEOUT": login_timeout,
"NETWORK_TIMEOUT": network_timeout,
"SOCKET_TIMEOUT": socket_timeout,
"PLATFORM": detect_platforms(
platform_detection_timeout_seconds=platform_detection_timeout_seconds
),
},
},
}
Expand Down Expand Up @@ -177,6 +182,7 @@ def authenticate(
self._rest._connection.login_timeout,
self._rest._connection._network_timeout,
self._rest._connection._socket_timeout,
self._rest._connection._platform_detection_timeout_seconds,
)

body = copy.deepcopy(body_template)
Expand Down
12 changes: 12 additions & 0 deletions src/snowflake/connector/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def _get_private_bytes_from_file(
), # network timeout (infinite by default)
"socket_timeout": (None, (type(None), int)),
"external_browser_timeout": (120, int),
"platform_detection_timeout_seconds": (
None,
(type(None), float),
), # Platform detection timeout for CSP metadata endpoints
"backoff_policy": (DEFAULT_BACKOFF_POLICY, Callable),
"passcode_in_password": (False, bool), # Snowflake MFA
"passcode": (None, (type(None), str)), # Snowflake MFA
Expand Down Expand Up @@ -704,6 +708,14 @@ def client_session_keep_alive_heartbeat_frequency(self, value) -> None:
self._client_session_keep_alive_heartbeat_frequency = value
self._validate_client_session_keep_alive_heartbeat_frequency()

@property
def platform_detection_timeout_seconds(self) -> float | None:
return self._platform_detection_timeout_seconds

@platform_detection_timeout_seconds.setter
def platform_detection_timeout_seconds(self, value) -> None:
self._platform_detection_timeout_seconds = value

@property
def client_prefetch_threads(self) -> int:
return (
Expand Down
Loading
Loading