File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
api/events/event_handlers Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 55
66from pydantic import BaseModel
77from sqlalchemy import update
8+ from sqlalchemy .orm import Session
89
910from configs import dify_config
1011from core .app .entities .app_invoke_entities import AgentChatAppGenerateEntity , ChatAppGenerateEntity
@@ -183,7 +184,7 @@ def _execute_provider_updates(updates_to_perform: list[_ProviderUpdateOperation]
183184
184185 # Use SQLAlchemy's context manager for transaction management
185186 # This automatically handles commit/rollback
186- with db .session . begin () :
187+ with Session ( db .engine ) as session :
187188 # Use a single transaction for all updates
188189 for update_operation in updates_to_perform :
189190 filters = update_operation .filters
@@ -214,7 +215,7 @@ def _execute_provider_updates(updates_to_perform: list[_ProviderUpdateOperation]
214215
215216 # Build and execute the update statement
216217 stmt = update (Provider ).where (* where_conditions ).values (** update_values )
217- result = db . session .execute (stmt )
218+ result = session .execute (stmt )
218219 rows_affected = result .rowcount
219220
220221 logger .debug (
You can’t perform that action at this time.
0 commit comments