Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

37 рядки
1.2KB

  1. # ext/asyncio/events.py
  2. # Copyright (C) 2020-2021 the SQLAlchemy authors and contributors
  3. # <see AUTHORS file>
  4. #
  5. # This module is part of SQLAlchemy and is released under
  6. # the MIT License: http://www.opensource.org/licenses/mit-license.php
  7. from .engine import AsyncConnectable
  8. from .session import AsyncSession
  9. from ...engine import events as engine_event
  10. from ...orm import events as orm_event
  11. class AsyncConnectionEvents(engine_event.ConnectionEvents):
  12. _target_class_doc = "SomeEngine"
  13. _dispatch_target = AsyncConnectable
  14. @classmethod
  15. def _listen(cls, event_key, retval=False):
  16. raise NotImplementedError(
  17. "asynchronous events are not implemented at this time. Apply "
  18. "synchronous listeners to the AsyncEngine.sync_engine or "
  19. "AsyncConnection.sync_connection attributes."
  20. )
  21. class AsyncSessionEvents(orm_event.SessionEvents):
  22. _target_class_doc = "SomeSession"
  23. _dispatch_target = AsyncSession
  24. @classmethod
  25. def _listen(cls, event_key, retval=False):
  26. raise NotImplementedError(
  27. "asynchronous events are not implemented at this time. Apply "
  28. "synchronous listeners to the AsyncSession.sync_session."
  29. )