Commit 7fdd83e
fix(databricks): use shared connection pool to prevent OAuth CSRF race
When concurrent_tasks > 1, DatabricksConnectionConfig previously used
ThreadLocalConnectionPool, which creates a separate databricks.sql.connect()
per thread. For U2M OAuth (databricks-oauth / azure-oauth), each thread
triggers an independent browser-based OAuth flow; these race on the CSRF
state parameter and cause MismatchingStateError.
Setting shared_connection = True causes ThreadLocalSharedConnectionPool to
be used instead: a single connection is created (behind a lock) and each
thread receives its own cursor, so only one OAuth flow is ever initiated.
This mirrors the existing pattern used by DuckDBConnectionConfig.
Fixes #5646
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Gabe Pesco <PescoG@medinsight.milliman.com>1 parent 8f092ac commit 7fdd83e
File tree
2 files changed
+31
-0
lines changed- sqlmesh/core/config
- tests/core
2 files changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
| 816 | + | |
| 817 | + | |
816 | 818 | | |
817 | 819 | | |
818 | 820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1422 | 1422 | | |
1423 | 1423 | | |
1424 | 1424 | | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
1425 | 1454 | | |
1426 | 1455 | | |
1427 | 1456 | | |
| |||
0 commit comments