Skip to content

Commit cebc584

Browse files
authored
v3.0.7 (#36)
Co-authored-by: ddc <ddc@users.noreply.github.com>
1 parent bdc49fe commit cebc584

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,18 @@
6868
## Default Session Settings
6969

7070
- `autoflush = False`
71-
- `expire_on_commit = False`
71+
- `expire_on_commit = False`
7272
- `echo = False`
7373

74+
**Autocommit Defaults by Database:**
75+
76+
| Database | Default | Convention |
77+
|------------|---------|----------------------------------|
78+
| PostgreSQL | `False` | Uses transactions by default |
79+
| MSSQL | `False` | Uses transactions by default |
80+
| MySQL | `True` | Autocommit ON is MySQL's default |
81+
| Oracle | `False` | Requires explicit COMMIT |
82+
7483
**Note:** All constructor parameters are optional and fall back to [.env](./ddcDatabases/.env.example) file variables.
7584

7685

ddcDatabases/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ ORACLE_SERVICENAME=xe
134134
ORACLE_ECHO=false
135135
ORACLE_AUTOFLUSH=false
136136
ORACLE_EXPIRE_ON_COMMIT=false
137-
ORACLE_AUTOCOMMIT=true
137+
ORACLE_AUTOCOMMIT=false
138138
# Pool settings
139139
ORACLE_CONNECTION_TIMEOUT=30
140140
ORACLE_POOL_RECYCLE=3600

ddcDatabases/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class OracleSettings(_BaseDBSettings):
240240
echo: bool = Field(default=False, description=Msg.ECHO_DESCRIPTION)
241241
autoflush: bool = Field(default=False, description=Msg.AUTOFLUSH_DESCRIPTION)
242242
expire_on_commit: bool = Field(default=False, description=Msg.EXPIRE_ON_COMMIT_DESCRIPTION)
243-
autocommit: bool = Field(default=True, description=Msg.AUTOCOMMIT_DESCRIPTION)
243+
autocommit: bool = Field(default=False, description=Msg.AUTOCOMMIT_DESCRIPTION)
244244
connection_timeout: int = Field(default=30, description=Msg.CONNECTION_TIMEOUT_DESCRIPTION)
245245
pool_recycle: int = Field(default=3600, description=Msg.POOL_RECYCLE_DESCRIPTION)
246246
pool_size: int = Field(default=10, description=Msg.POOL_SIZE_DESCRIPTION)

tests/unit/test_oracle.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,24 @@ def _create_mock_settings(self, **overrides):
2121
"sync_driver": "oracle+oracledb",
2222
"autoflush": False,
2323
"expire_on_commit": False,
24-
"autocommit": True,
24+
"autocommit": False,
2525
"connection_timeout": 30,
2626
"pool_recycle": 3600,
2727
"pool_size": 10,
2828
"max_overflow": 20,
2929
"ssl_enabled": False,
3030
"ssl_wallet_path": None,
31-
"enable_retry": True,
32-
"max_retries": 3,
33-
"initial_retry_delay": 1.0,
34-
"max_retry_delay": 30.0,
31+
# Connection retry settings
32+
"conn_enable_retry": True,
33+
"conn_max_retries": 3,
34+
"conn_initial_retry_delay": 1.0,
35+
"conn_max_retry_delay": 30.0,
36+
# Operation retry settings
37+
"op_enable_retry": True,
38+
"op_max_retries": 3,
39+
"op_initial_retry_delay": 0.5,
40+
"op_max_retry_delay": 10.0,
41+
"op_jitter": 0.1,
3542
}
3643
defaults.update(overrides)
3744
for key, value in defaults.items():
@@ -220,7 +227,7 @@ def test_all_parameters_defaults(self, mock_get_settings):
220227

221228
assert oracle._session_config.autoflush == False
222229
assert oracle._session_config.expire_on_commit == False
223-
assert oracle._session_config.autocommit == True
230+
assert oracle._session_config.autocommit == False
224231
assert oracle._pool_config.connection_timeout == 30
225232

226233
@patch('ddcDatabases.oracle.get_oracle_settings')

0 commit comments

Comments
 (0)