dify/api/models
QuantumGhost d9eb1a73af
fix(api): fix `DetachedInstanceError` for Account.current_tenant_id (#24789)
The `Account._current_tenant` object is loaded by a database session (typically `db.session`) whose lifetime 
is not aligned with the Account model instance. This misalignment causes a `DetachedInstanceError` to be raised
when accessing attributes of `Account._current_tenant` after the original session has been closed.

To resolve this issue, we now reload the tenant object with `expire_on_commit=False`, ensuring the tenant remains
accessible even after the session is closed.
2025-08-29 19:12:02 +08:00
..
__init__.py feat: add MCP support (#20716) 2025-07-10 14:01:34 +08:00
_workflow_exc.py feat: Persist Variables for Enhanced Debugging Workflow (#20699) 2025-06-24 09:05:29 +08:00
account.py fix(api): fix `DetachedInstanceError` for Account.current_tenant_id (#24789) 2025-08-29 19:12:02 +08:00
api_based_extension.py replace db with sa to get typing support (#23240) 2025-08-02 23:54:23 +08:00
base.py refactor: Use typed SQLAlchemy base model and fix type errors (#19980) 2025-05-21 15:38:03 +08:00
dataset.py example on orm typing (#23322) 2025-08-26 18:16:58 +08:00
engine.py feat(api): Add image multimodal support for LLMNode (#17372) 2025-04-30 17:28:02 +08:00
enums.py moving the `MessageStatus` class from the `models.model` module to `models.enums` module (#21867) 2025-07-03 13:56:23 +08:00
model.py chore: change the oauth_provider_apps table to uuidV7 (#24792) 2025-08-29 17:54:14 +08:00
provider.py chore(api): Use uuidv7 as PK for new provider crendential tables (#24545) 2025-08-27 11:22:08 +08:00
source.py replace db with sa to get typing support (#23240) 2025-08-02 23:54:23 +08:00
task.py chore: apply static type checks on celery async task dispatches and imports (#24418) 2025-08-24 23:07:22 +08:00
tools.py Feat/improved mcp timeout configs (#23605) 2025-08-12 13:14:00 +08:00
types.py feat(api): Introduce `WorkflowDraftVariable` Model (#19737) 2025-05-19 22:59:56 +08:00
web.py replace db with sa to get typing support (#23240) 2025-08-02 23:54:23 +08:00
workflow.py Refactor: replace count() > 0 check with exists() (#24583) 2025-08-27 17:46:52 +08:00