1515# The Databricks SDK CredentialsProvider == Databricks SQL HeaderFactory
1616CredentialsProvider = Callable [[], Dict [str , str ]]
1717
18+
1819class CredentialsStrategy (abc .ABC ):
1920 """Maintain compatibility with the Databricks SQL/SDK client libraries.
2021
21- https://github.com/databricks/databricks-sql-python/blob/v3.3.0/src/databricks/sql/auth/authenticators.py#L19-L33
22- https://github.com/databricks/databricks-sdk-py/blob/v0.29.0/databricks/sdk/credentials_provider.py#L44-L54
22+ See Also
23+ --------
24+ * https://github.com/databricks/databricks-sql-python/blob/v3.3.0/src/databricks/sql/auth/authenticators.py#L19-L33
25+ * https://github.com/databricks/databricks-sdk-py/blob/v0.29.0/databricks/sdk/credentials_provider.py#L44-L54
2326 """
2427
2528 @abc .abstractmethod
@@ -47,7 +50,8 @@ def _new_bearer_authorization_header(credentials: Credentials) -> Dict[str, str]
4750 raise ValueError ("Missing value for field 'access_token' in credentials." )
4851 return {"Authorization" : f"Bearer { access_token } " }
4952
50- def _get_auth_type (local_auth_type : str ) -> str :
53+
54+ def _get_auth_type (local_auth_type : str ) -> str :
5155 """Returns the auth type currently in use.
5256
5357 The databricks-sdk client uses the configured auth_type to create
@@ -62,16 +66,15 @@ def _get_auth_type(local_auth_type: str) -> str:
6266 See Also
6367 --------
6468 * https://github.com/databricks/databricks-sdk-py/blob/v0.29.0/databricks/sdk/config.py#L261-L269
65-
69+
6670 Returns
6771 -------
6872 str
6973 """
7074 if is_local ():
7175 return local_auth_type
7276
73- return POSIT_OAUTH_INTEGRATION_AUTH_TYPE
74-
77+ return POSIT_OAUTH_INTEGRATION_AUTH_TYPE
7578
7679
7780class PositContentCredentialsProvider :
@@ -117,7 +120,7 @@ def __call__(self) -> Dict[str, str]:
117120class PositContentCredentialsStrategy (CredentialsStrategy ):
118121 """`CredentialsStrategy` implementation which supports interacting with Service Account OAuth integrations on Connect.
119122
120- This strategy callable class returns a `PositContentCredentialsProvider` when hosted on Connect, and
123+ This strategy callable class returns a `PositContentCredentialsProvider` when hosted on Connect, and
121124 its `local_strategy` strategy otherwise.
122125
123126 Examples
@@ -130,7 +133,6 @@ class PositContentCredentialsStrategy(CredentialsStrategy):
130133 from posit.connect.external.databricks import PositContentCredentialsStrategy
131134
132135 import pandas as pd
133-
134136 from databricks import sql
135137 from databricks.sdk.core import ApiClient, Config, databricks_cli
136138 from databricks.sdk.service.iam import CurrentUserAPI
@@ -197,7 +199,7 @@ def __call__(self, *args, **kwargs) -> CredentialsProvider:
197199class PositCredentialsStrategy (CredentialsStrategy ):
198200 """`CredentialsStrategy` implementation which supports interacting with Viewer OAuth integrations on Connect.
199201
200- This strategy callable class returns a `PositCredentialsProvider` when hosted on Connect, and
202+ This strategy callable class returns a `PositCredentialsProvider` when hosted on Connect, and
201203 its `local_strategy` strategy otherwise.
202204
203205 Examples
@@ -222,6 +224,7 @@ class PositCredentialsStrategy(CredentialsStrategy):
222224
223225 app_ui = ui.page_fluid(ui.output_text("text"), ui.output_data_frame("result"))
224226
227+
225228 def server(i: Inputs, o: Outputs, session: Session):
226229
227230 # HTTP session headers are available in this context.
@@ -250,7 +253,8 @@ def result():
250253 def text():
251254 databricks_user_info = CurrentUserAPI(ApiClient(cfg)).me()
252255 return f"Hello, {databricks_user_info.display_name}!"
253-
256+
257+
254258 app = App(app_ui, server)
255259 ```
256260 """
0 commit comments