Skip to content

Commit 2042938

Browse files
committed
sweep through docstrings in response to PR comments
1 parent 144e895 commit 2042938

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/posit/connect/external/databricks.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __call__(self) -> Dict[str, str]:
155155
return _new_bearer_authorization_header(credentials)
156156

157157
class PositLocalContentCredentialsStrategy(CredentialsStrategy):
158-
"""`CredentialsStrategy` implementation which supports local development using OAuth M2M authentication against databricks.
158+
"""`CredentialsStrategy` implementation which supports local development using OAuth M2M authentication against Databricks.
159159
160160
There is an open issue against the Databricks CLI which prevents it from returning service principal access tokens.
161161
https://github.com/databricks/cli/issues/1939
@@ -165,14 +165,12 @@ class PositLocalContentCredentialsStrategy(CredentialsStrategy):
165165
166166
Examples
167167
--------
168-
In the example below, the PositContentCredentialsStrategy can be initialized anywhere that
168+
In the example below, the `PositContentCredentialsStrategy` can be initialized anywhere that
169169
the Python process can read environment variables.
170170
171-
CLIENT_ID and CLIENT_SECRET credentials associated with the Databricks Service Principal.
171+
CLIENT_ID and CLIENT_SECRET are credentials associated with the Databricks service principal.
172172
173173
```python
174-
import os
175-
176174
from posit.connect.external.databricks import PositContentCredentialsStrategy, PositLocalContentCredentialsStrategy
177175
178176
import pandas as pd
@@ -189,7 +187,7 @@ class PositLocalContentCredentialsStrategy(CredentialsStrategy):
189187
CLIENT_SECRET = "<REDACTED>"
190188
191189
# Rather than relying on the Databricks CLI as a local strategy, we use
192-
# PositLocalContentCredentialsStragtegy as a drop-in replacement.
190+
# PositLocalContentCredentialsStrategy as a drop-in replacement.
193191
# Can be replaced with the Databricks CLI implementation when
194192
# https://github.com/databricks/cli/issues/1939 is resolved.
195193
local_strategy = PositLocalContentCredentialsStrategy(
@@ -249,7 +247,7 @@ class PositContentCredentialsStrategy(CredentialsStrategy):
249247
250248
Examples
251249
--------
252-
NOTE: in the example below, the PositContentCredentialsStrategy can be initialized anywhere that
250+
NOTE: in the example below, the `PositContentCredentialsStrategy` can be initialized anywhere that
253251
the Python process can read environment variables.
254252
255253
```python
@@ -264,7 +262,13 @@ class PositContentCredentialsStrategy(CredentialsStrategy):
264262
DATABRICKS_HOST_URL = f"https://{DATABRICKS_HOST}"
265263
SQL_HTTP_PATH = "<REDACTED>"
266264
267-
# reads `CONNECT_CONTENT_SESSION_TOKEN` environment variable if hosted on Connect
265+
# NOTE: currently the databricks_cli local strategy only supports auth code OAuth flows.
266+
# https://github.com/databricks/cli/issues/1939
267+
#
268+
# This means that the databricks_cli supports local development using the developer's
269+
# databricks credentials, but not the credentials for a service principal.
270+
# To fallback to service principal credentials in local development, use
271+
# `PositLocalContentCredentialsStrategy` as a drop-in replacement.
268272
posit_strategy = PositContentCredentialsStrategy(local_strategy=databricks_cli)
269273
270274
cfg = Config(host=DATABRICKS_HOST_URL, credentials_strategy=posit_strategy)

0 commit comments

Comments
 (0)