summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/session.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
-rw-r--r--lib/sqlalchemy/ext/asyncio/session.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py
index faa279cf9..93af178a3 100644
--- a/lib/sqlalchemy/ext/asyncio/session.py
+++ b/lib/sqlalchemy/ext/asyncio/session.py
@@ -28,7 +28,6 @@ T = TypeVar("T")
"__iter__",
"add",
"add_all",
- "delete",
"expire",
"expire_all",
"expunge",
@@ -223,6 +222,18 @@ class AsyncSession:
)
return _result.AsyncResult(result)
+ async def delete(self, instance):
+ """Mark an instance as deleted.
+
+ The database delete operation occurs upon ``flush()``.
+
+ As this operation may need to cascade along unloaded relationships,
+ it is awaitable to allow for those queries to take place.
+
+
+ """
+ return await greenlet_spawn(self.sync_session.delete, instance)
+
async def merge(self, instance, load=True):
"""Copy the state of a given instance into a corresponding instance
within this :class:`_asyncio.AsyncSession`.