Commit 461a594
feat: Databricks OAuth (M2M + Azure service principal) auth [PLATL-820] (#2781)
* feat(databricks): OAuth (M2M + Azure service principal) auth for soda-databricks
Add an auth_type discriminator to the Databricks connector with two OAuth
client-credentials modes — databricks-oauth-m2m and azure-service-principal —
alongside the existing personal-access-token auth. OAuth modes build a
Databricks SDK credentials_provider and strip credential fields from
sql.connect kwargs; PAT stays the default when auth_type is absent.
PLATL-820
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix(databricks): resolve SonarCloud S5332 clear-text-HTTP finding in test
_with_https used a literal 'http://' in chained startswith calls, which
SonarCloud flagged as 'Using HTTP protocol is insecure' (S5332) — the
sole condition failing the Quality Gate on PR #2781 (B Security Rating
on New Code); also clears the paired chained-startswith smell. Replace
with a scheme-agnostic '://' membership test; behavior unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(databricks): correct OAuth credentials_provider shape + fail-loud (review)
Address review on PR #2781:
- Blocker: credentials_provider was one level too shallow. ExternalAuthProvider
calls credentials_provider() once to get the header factory, then calls that
per request; passing the SDK factory directly made the per-request call raise
'dict object is not callable', so no OAuth (M2M or Azure SP) connection could
be established. Wrap the SDK header factory in a zero-arg lambda.
- Raise a clear ValueError when the SDK yields no header factory instead of
silently degrading to a credential-less PAT connect.
- Cap databricks-sdk to >=0.19,<1 (provider import paths move across majors).
- Tests now drive provider()() to a headers dict (catching the shape bug) and
cover the None->error path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(deps): regenerate uv.lock for the databricks-sdk dependency
Fixes the `uv lock --check` failure in the pre-commit & lockfile CI job.
PLATL-820
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(databricks): address review — sdk floor, drop provisional note
PR #2781 review (Niels-b):
- Bump databricks-sdk floor to >=0.117,<1 (was >=0.19): 0.19 predates the
credentials-provider surface the OAuth path imports and no CI job exercises
the floor; uv.lock resolves 0.119.0 and the fix was verified against 0.117.
Regenerated uv.lock (uv lock --check).
- Drop the 'provisional / confirm with BE' note and dangling implementation-plan.md
reference on the auth_type literals — the cross-repo contract is confirmed
(soda-library#759 + Cloud form); reduced to a plain contract statement.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(databricks): set databricks-sdk floor to >=0.19,<1 (was 0.117)
Revert the 0.117 floor. Verified against the SDK source at tag v0.19.0 that
the OAuth surface we use is already present at 0.19.0 — oauth_service_principal,
azure_service_principal, and Config(client_id/client_secret/azure_*). So 0.117
(a 2026-06 release) excluded ~2 years of compatible releases for no benefit and
risked resolver conflicts. Keep the <1 major cap (the genuinely useful guard).
Regenerated uv.lock (still resolves 0.119.0 at the top).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 700c9a5 commit 461a594
7 files changed
Lines changed: 559 additions & 31 deletions
File tree
- soda-databricks
- src/soda_databricks
- common/data_sources
- model/data_source
- tests
- data_sources
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
Lines changed: 69 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
30 | 46 | | |
31 | 47 | | |
32 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
33 | 66 | | |
34 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
35 | 103 | | |
36 | 104 | | |
37 | 105 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
Lines changed: 37 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
11 | 25 | | |
12 | 26 | | |
13 | 27 | | |
| |||
18 | 32 | | |
19 | 33 | | |
20 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
21 | 54 | | |
22 | 55 | | |
23 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
26 | 52 | | |
27 | 53 | | |
28 | 54 | | |
| 55 | + | |
| 56 | + | |
29 | 57 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
33 | 61 | | |
34 | 62 | | |
35 | 63 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
40 | 67 | | |
| 68 | + | |
| 69 | + | |
41 | 70 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
45 | 74 | | |
46 | 75 | | |
47 | 76 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
53 | 81 | | |
54 | | - | |
55 | | - | |
| 82 | + | |
| 83 | + | |
56 | 84 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
60 | 88 | | |
61 | 89 | | |
62 | 90 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
67 | 96 | | |
| 97 | + | |
| 98 | + | |
68 | 99 | | |
69 | 100 | | |
70 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
71 | 182 | | |
72 | 183 | | |
73 | 184 | | |
| |||
0 commit comments