Commit 29cd8f8
committed
feat: Add multi-statement transaction support
Implement PEP 249-compliant transaction control with extensions for
manual commit/rollback operations. This enables atomic multi-table
operations with REPEATABLE_READ isolation semantics.
Core API additions:
- connection.autocommit property for enabling/disabling auto-commit mode
- connection.commit() to commit active transactions
- connection.rollback() to rollback active transactions
- connection.get_transaction_isolation() returns current isolation level
- connection.set_transaction_isolation() validates isolation level
- TransactionError exception for transaction-specific failures
Implementation details:
- Added autocommit state caching in Session with optional server query
- Added TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ constant
- All transaction operations include proper error handling and telemetry
- Supports fetch_autocommit_from_server connection parameter
Testing:
- Unit tests covering all transaction methods and error scenarios
- e2e integration tests validating transaction behavior including
multi-table atomicity, sequential transactions, and isolation semantics
Documentation:
- Comprehensive TRANSACTIONS.md guide with examples and best practices
- Updated README.md with basic usage and reference to detailed docs
Requires MST-enabled Databricks SQL warehouse and Delta tables with
'delta.feature.catalogOwned-preview' table property.1 parent fd65fd2 commit 29cd8f8
File tree
8 files changed
+1674
-20
lines changed- src/databricks/sql
- tests
- e2e
- unit
8 files changed
+1674
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 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 | + | |
70 | 101 | | |
71 | 102 | | |
72 | 103 | | |
| |||
0 commit comments