mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-23 12:40:42 +08:00
* fix: isolation level and nested db.commit() with retry wrappers on concurrent update errors * refactor: incorporated review comments changes decorator methods to managed_tx_method and async_managed_tx_method new enum CommitMode removed commented commit() from the previous commits * fix: merge pre-commit errors * fix: merge pre-commit changes * fix: conflict in existing OasstErrorCode * refactor: Added a refresh just to be sure that the select command is triggered on the mapped object * fix: added refresh for async decorator Co-authored-by: James Melvin <melvin@gameface.ai>
9 lines
364 B
Python
9 lines
364 B
Python
from oasst_backend.config import settings
|
|
from oasst_shared.exceptions import OasstError, OasstErrorCode
|
|
from sqlmodel import create_engine
|
|
|
|
if settings.DATABASE_URI is None:
|
|
raise OasstError("DATABASE_URI is not set", error_code=OasstErrorCode.DATABASE_URI_NOT_SET)
|
|
|
|
engine = create_engine(settings.DATABASE_URI, echo=True, isolation_level="REPEATABLE READ")
|