Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcfa38a1

Browse files
authored
Support custom oauth client id and redirect port (#75)
* Support custom oauth client id and rediret port rangePySQL is used by other tools/CLIs which have own oauth client id,we need to expose oauth_client_id and oauth_redirect_port_rangeas the connection parameters to support this customization.Signed-off-by: Jacky Hu <jacky.hu@databricks.com>* Change oauth redirect port range to portSigned-off-by: Jacky Hu <jacky.hu@databricks.com>* Fix type check issueSigned-off-by: Jacky Hu <jacky.hu@databricks.com>Signed-off-by: Jacky Hu <jacky.hu@databricks.com>
1 parent4f221b3 commitcfa38a1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎src/databricks/sql/auth/auth.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ def get_python_sql_connector_auth_provider(hostname: str, **kwargs):
8989
use_cert_as_auth=kwargs.get("_use_cert_as_auth"),
9090
tls_client_cert_file=kwargs.get("_tls_client_cert_file"),
9191
oauth_scopes=PYSQL_OAUTH_SCOPES,
92-
oauth_client_id=PYSQL_OAUTH_CLIENT_ID,
93-
oauth_redirect_port_range=PYSQL_OAUTH_REDIRECT_PORT_RANGE,
92+
oauth_client_id=kwargs.get("oauth_client_id")orPYSQL_OAUTH_CLIENT_ID,
93+
oauth_redirect_port_range=[kwargs["oauth_redirect_port"]]
94+
ifkwargs.get("oauth_client_id")andkwargs.get("oauth_redirect_port")
95+
elsePYSQL_OAUTH_REDIRECT_PORT_RANGE,
9496
oauth_persistence=kwargs.get("experimental_oauth_persistence"),
9597
)
9698
returnget_auth_provider(cfg)

‎src/databricks/sql/client.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ def __init__(
6060
any IDP configured. This is only for interactive python applications and open a browser window.
6161
Note this is beta (private preview)
6262
63+
oauth_client_id: `str`, optional
64+
custom oauth client_id. If not specified, it will use the built-in client_id of databricks-sql-python.
65+
66+
oauth_redirect_port: `int`, optional
67+
port of the oauth redirect uri (localhost). This is required when custom oauth client_id
68+
`oauth_client_id` is set
69+
6370
experimental_oauth_persistence: configures preferred storage for persisting oauth tokens.
6471
This has to be a class implementing `OAuthPersistence`.
6572
When `auth_type` is set to `databricks-oauth` without persisting the oauth token in a persistence storage

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp